Skip to content

Commit

Permalink
Made tests checks more exact and added some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tfzee committed Aug 14, 2024
1 parent fd48bd5 commit f0e5f1a
Show file tree
Hide file tree
Showing 38 changed files with 45 additions and 46 deletions.
2 changes: 1 addition & 1 deletion testsuite/cuda-only/_cudaHostAllocBlock_user_malloc__nok.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// clang-format on

// HECK-DAG: data race
// HECK-DAG: ThreadSanitizer: data race
// CHECK-DAG: [Error] sync

#include <cstdio>
Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-only/_cudaHostAlloc_user_malloc__nok.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// clang-format on

// HECK-DAG: data race
// HECK-DAG: ThreadSanitizer: data race
// CHECK-DAG: [Error] sync

#include <cstdio>
Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-only/_cudaMallocBlock_user_malloc__nok.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// clang-format on

// CHECK-DAG: data race
// CHECK-DAG: ThreadSanitizer: data race
// CHECK-DAG: [Error] sync

#include <cstdio>
Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-only/_cudaMalloc_user_malloc__nok.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// clang-format on

// CHECK-DAG: data race
// CHECK-DAG: ThreadSanitizer: data race
// CHECK-DAG: [Error] sync
#include <cstdio>
#include <cuda_runtime.h>
Expand Down
4 changes: 2 additions & 2 deletions testsuite/cuda-only/_cudafreeBlock_user_malloc_w_.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// clang-format on

// CHECK-NOT: data race
// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: [Error] sync

#include <cstdio>
Expand Down Expand Up @@ -48,7 +48,7 @@ int main() {
write_kernel_delay<<<blocksPerGrid, threadsPerBlock, 0, stream1>>>(data, size, 1316134912);
// do a free which implicitly syncs/blocks
cudaFree(data2);

//so this memcpy is safe
cudaMemcpyAsync(h_data, data, size * sizeof(int), cudaMemcpyDefault, stream2);
cudaStreamSynchronize(stream2);
for (int i = 0; i < size; i++) {
Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-only/_cudafreeHostBlock_user_managed_w_.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// clang-format on

// HECK-NOT: data race
// HECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: [Error] sync

#include <cstdio>
Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-only/_cudafreeHost_user_managed_w_.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// clang-format on

// HECK-NOT: data race
// HECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: [Error] sync

#include <cstdio>
Expand Down
4 changes: 2 additions & 2 deletions testsuite/cuda-only/_cudafree_user_malloc_w_.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// RUN: %tsan-options %cutests_test_dir/%basename_t.exe 2>&1 | %filecheck %s

// clang-format on

// CHECK-NOT: data race
// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: [Error] sync

#include <cstdio>
Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-only/_ds_defuser_managed_w_.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-only/_ds_defuser_managed_w__nok.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-DAG: ThreadSanitizer: data race
// CHECK-DAG: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-DAG: [Error]
// CHECK-DAG: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-only/_mc_4_def_managed_w__nok.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-DAG: ThreadSanitizer: data race
// CHECK-DAG: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-DAG: [Error]
// CHECK-DAG: [Error] sync

// REQUIRES: mca-rules

Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-to-mpi/send_ds_def_malloc_r_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-to-mpi/send_ds_def_malloc_w_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
5 changes: 2 additions & 3 deletions testsuite/cuda-to-mpi/send_ds_def_malloc_w_r_nok.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ int main(int argc, char* argv[]) {
cudaDeviceSynchronize();

if (world_rank == 0) {
//this kernel reads d_data
kernel<<<blocksPerGrid, threadsPerBlock>>>(d_data, size);
#ifdef cusan_SYNC
cudaDeviceSynchronize(); // FIXME: uncomment for correct execution
#endif
//mpi aswell so we get a race
MPI_Send(d_data, size, MPI_INT, 1, 0, MPI_COMM_WORLD);
} else if (world_rank == 1) {
MPI_Recv(d_data, size, MPI_INT, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
Expand Down
5 changes: 3 additions & 2 deletions testsuite/cuda-to-mpi/send_ds_def_managed_r_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down Expand Up @@ -52,8 +52,9 @@ int main(int argc, char* argv[]) {
if (world_rank == 0) {
int* d_sum;
cudaMalloc(&d_sum, size * sizeof(int));
//kernel only reads d_data
kernel<<<blocksPerGrid, threadsPerBlock>>>(d_sum, d_data, size);

//same with mpi as such theres no race
MPI_Send(d_data, size, MPI_INT, 1, 0, MPI_COMM_WORLD);
cudaFree(d_sum);
} else if (world_rank == 1) {
Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-to-mpi/send_ds_def_managed_w_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-to-mpi/send_ds_def_managed_w_r_functor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
7 changes: 3 additions & 4 deletions testsuite/cuda-to-mpi/send_ds_def_managed_w_r_functor_nok.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-DAG: ThreadSanitizer: data race
// CHECK-DAG: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-DAG: [Error]
// CHECK-DAG: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down Expand Up @@ -53,10 +53,9 @@ int main(int argc, char* argv[]) {

if (world_rank == 0) {
const auto lamba_kernel = [=] __host__ __device__(const int tid) { d_data[tid] = (tid + 1); };
//the kernel indirectly writes the d_data via the lambda function
kernel_functor<decltype(lamba_kernel)><<<blocksPerGrid, threadsPerBlock>>>(lamba_kernel);
#ifdef cusan_SYNC
cudaDeviceSynchronize(); // FIXME: uncomment for correct execution
#endif
//and so we get a race with mpi
MPI_Send(d_data, size, MPI_INT, 1, 0, MPI_COMM_WORLD);
} else if (world_rank == 1) {
MPI_Recv(d_data, size, MPI_INT, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-to-mpi/send_ds_def_managed_w_r_nok.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-DAG: ThreadSanitizer: data race
// CHECK-DAG: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-DAG: [Error]
// CHECK-DAG: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-to-mpi/send_eq_def_malloc_w_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-to-mpi/send_es_def_malloc_w_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-to-mpi/send_mc_def_malloc_w_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-to-mpi/send_mca_4_user_malloc_w_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-to-mpi/send_mca_4_user_malloc_w_r_nok.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-DAG: ThreadSanitizer: data race
// CHECK-DAG: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-DAG: [Error]
// CHECK-DAG: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-to-mpi/send_ms_def_malloc_w_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-to-mpi/send_ms_def_malloc_w_r_nok.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-DAG: ThreadSanitizer: data race
// CHECK-DAG: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-DAG: [Error]
// CHECK-DAG: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-to-mpi/send_ms_pinned_def_malloc_w_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-to-mpi/send_ms_pinned_defuser_malloc_w_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-DAG: ThreadSanitizer: data race
// CHECK-DAG: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-DAG: [Error]
// CHECK-DAG: [Error] sync
// CHECK-NOT: [Alloc]

// REQUIRES: msa-rules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-DAG: ThreadSanitizer: data race
// CHECK-DAG: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-DAG: [Error]
// CHECK-DAG: [Error] sync

// REQUIRES: msa-rules

Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-to-mpi/send_sq_user_malloc_w_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-to-mpi/send_ss_user_malloc_r_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/cuda-to-mpi/send_ss_user_malloc_w_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/mpi-to-cuda/irecv_ds_def_malloc_w_w.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/mpi-to-cuda/irecv_ds_def_malloc_w_w_nok.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-DAG: ThreadSanitizer: data race
// CHECK-DAG: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-DAG: [Error]
// CHECK-DAG: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/mpi-to-cuda/irecv_ds_def_managed_w_w.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/mpi-to-cuda/irecv_ds_def_managed_w_w_nok.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-DAG: ThreadSanitizer: data race
// CHECK-DAG: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-DAG: [Error]
// CHECK-DAG: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down
2 changes: 1 addition & 1 deletion testsuite/mpi-to-cuda/isend_ds_def_malloc_w_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK-NOT: ThreadSanitizer: data race
// CHECK-NOT: Thread T{{[0-9]+}} 'cuda_stream'
// CHECK-NOT: [Error]
// CHECK-NOT: [Error] sync

#include "../support/gpu_mpi.h"

Expand Down

0 comments on commit f0e5f1a

Please sign in to comment.