Skip to content

Commit

Permalink
[cuda] Enable filecheck on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vgvassilev committed Sep 10, 2024
1 parent aa69263 commit 821f86a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 31 deletions.
18 changes: 10 additions & 8 deletions test/CUDA/ForwardMode.cu
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// RUN: %cladclang_cuda -I%S/../../include %s -xc++ %cudasmlevel \
// RUN: --cuda-path=%cudapath -L/usr/local/cuda/lib64 -lcudart_static \
// RUN: -ldl -lrt -pthread -lm -lstdc++ -oForwardMode.out 2>&1 | %filecheck %s

// RUN: ./ForwardMode.out

// RUN: %cladclang_cuda -I%S/../../include --cuda-path=%cudapath \
// RUN: --cuda-gpu-arch=%cudaarch %cudaldflags -oForwardMode.out \
// RUN: -Xclang -verify %s 2>&1 | %filecheck %s
//
// RUN: ./ForwardMode.out | %filecheck_exec %s
//
// REQUIRES: cuda-runtime

//
// expected-no-diagnostics
//
// CHECK-NOT: {{.*error|warning|note:.*}}

#include "clad/Differentiator/Differentiator.h"
#include "../TestUtils.h"
Expand Down Expand Up @@ -121,4 +123,4 @@ int main() {
INIT_DIFFERENTIATE(fn1, "i");

TEST_DIFFERENTIATE(fn1, 3, 5); // CHECK-EXEC: 8000.00
}
}
24 changes: 13 additions & 11 deletions test/CUDA/GradientCuda.cu
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
// The Test checks whether a clad gradient can be successfully be generated on
// the device having all the dependencies also as device functions.

// RUN: %cladclang_cuda -I%S/../../include %s -fsyntax-only \
// RUN: %cudasmlevel --cuda-path=%cudapath -Xclang -verify 2>&1 | %filecheck %s

// RUN: %cladclang_cuda -I%S/../../include %s -xc++ %cudasmlevel \
// RUN: --cuda-path=%cudapath -L/usr/local/cuda/lib64 -lcudart_static \
// RUN: -ldl -lrt -pthread -lm -lstdc++

// RUN: %cladclang_cuda -I%S/../../include -fsyntax-only \
// RUN: --cuda-gpu-arch=%cudaarch --cuda-path=%cudapath -Xclang -verify \
// RUN: %s 2>&1 | %filecheck %s
//
// RUN: %cladclang_cuda -I%S/../../include --cuda-gpu-arch=%cudaarch \
// RUN --cuda-path=%cudapath %cudaldflags -oGradientCuda.out %s
//
// RUN: ./GradientCuda.out | %filecheck_exec %s
//
// REQUIRES: cuda-runtime

//
// expected-no-diagnostics

// XFAIL: clang-15
//
// CHECK-NOT: {{.*error|warning|note:.*}}

#include "clad/Differentiator/Differentiator.h"
#include <array>
Expand Down Expand Up @@ -116,7 +118,7 @@ int main(void) {
cudaDeviceSynchronize();

cudaMemcpy(result.data(), d_result, N * sizeof(double), cudaMemcpyDeviceToHost);
printf("%f,%f,%f\n", result[0], result[1], result[2]);
printf("%f,%f,%f\n", result[0], result[1], result[2]); // CHECK-EXEC: 0.007714,0.007714,0.007714

std::array<double, N> result_cpu{0};
auto gauss_g = clad::gradient(gauss, "p");
Expand Down
25 changes: 13 additions & 12 deletions test/CUDA/GradientKernels.cu
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
// RUN: %cladclang_cuda -I%S/../../include %s -fsyntax-only \
// RUN: %cudasmlevel --cuda-path=%cudapath -Xclang -verify 2>&1 | %filecheck %s

// RUN: %cladclang_cuda -I%S/../../include %s -xc++ %cudasmlevel \
// RUN: --cuda-path=%cudapath -L/usr/local/cuda/lib64 -lcudart_static \
// RUN: -L%cudapath/lib64/stubs \
// RUN: -ldl -lrt -pthread -lm -lstdc++ -lcuda -lnvrtc

// RUN: %cladclang_cuda -I%S/../../include -fsyntax-only \
// RUN: --cuda-gpu-arch=%cudaarch --cuda-path=%cudapath -Xclang -verify \
// RUN: %s 2>&1 | %filecheck %s
//
// RUN: %cladclang_cuda -I%S/../../include --cuda-path=%cudapath
// RUN: --cuda-gpu-arch=%cudaarch %cudaldflags -oGradientKernels.out %s
//
// RUN: ./GradientKernels.out | %filecheck_exec %s
//
// REQUIRES: cuda-runtime

//
// expected-no-diagnostics

// XFAIL: clang-15
//
// CHECK-NOT: {{.*error|warning|note:.*}}

#include "clad/Differentiator/Differentiator.h"

Expand Down Expand Up @@ -76,4 +77,4 @@ int main(void) {
printf("a = %d, a^2 = %d\n", *a, *asquare); // CHECK-EXEC: a = 5, a^2 = 10

return 0;
}
}

0 comments on commit 821f86a

Please sign in to comment.