From 4674cfa0835ae777c0eb9a75562bfb16e28d1bbe Mon Sep 17 00:00:00 2001 From: David Koes Date: Fri, 12 Jul 2024 12:31:00 -0400 Subject: [PATCH] Rearrange thrust includes for CUDA 12.5 compat --- test/test_mgrid.cpp | 40 ---------------------------------------- test/test_mgrid.cu | 38 ++++++++++++++++++++++++++++++++++++++ test/test_transform.cpp | 2 -- 3 files changed, 38 insertions(+), 42 deletions(-) diff --git a/test/test_mgrid.cpp b/test/test_mgrid.cpp index 15a856c1..014d8920 100644 --- a/test/test_mgrid.cpp +++ b/test/test_mgrid.cpp @@ -7,9 +7,6 @@ #define BOOST_TEST_MODULE grid_test #include -#include -#include - #include "libmolgrid/managed_grid.h" using namespace libmolgrid; @@ -88,43 +85,6 @@ BOOST_AUTO_TEST_CASE( indirect_indexing ) } -BOOST_AUTO_TEST_CASE( grid_conversion ) -{ - MGrid3f g3(7,13,11); - MGrid1f g1(100); - - for(unsigned i = 0; i < 7; i++) - for(unsigned j = 0; j < 13; j++) - for(unsigned k = 0; k < 11; k++) { - g3[i][j][k] = i+j+k; - } - - for(unsigned i = 0; i < 100; i++) { - g1(i) = i; - } - - Grid3f cpu3(g3); - Grid1f cpu1 = g1.cpu(); - - float sum3 = thrust::reduce(thrust::host, cpu3.data(), cpu3.data()+cpu3.size()); - BOOST_CHECK_EQUAL(sum3,14014); - - float sum1 = thrust::reduce(thrust::host, cpu1.data(), cpu1.data()+cpu1.size()); - BOOST_CHECK_EQUAL(sum1,4950); - - MGrid6d g6(3,4,5,2,1,10); - g6[2][2][2][0][0][5] = 3.14; - Grid6d cpu6 = (Grid6d)g6; //cast conversion - BOOST_CHECK_EQUAL(cpu6.size(),1200); - BOOST_CHECK_EQUAL(cpu6(2,2,2,0,0,5), 3.14); - - Grid6dCUDA gpu6 = (Grid6dCUDA)g6; - double *cudaptr = gpu6.address(2,2,2,0,0,5); - double val = 0; - cudaMemcpy(&val, cudaptr, sizeof(double), cudaMemcpyDeviceToHost); - BOOST_CHECK_EQUAL(val, 3.14); - -} BOOST_AUTO_TEST_CASE( blank_mgrid ) diff --git a/test/test_mgrid.cu b/test/test_mgrid.cu index b4b1a424..71764c6f 100644 --- a/test/test_mgrid.cu +++ b/test/test_mgrid.cu @@ -60,3 +60,41 @@ BOOST_AUTO_TEST_CASE( grid_conversion ) cudaError_t error = cudaGetLastError(); BOOST_CHECK_EQUAL(error,cudaSuccess); } + +BOOST_AUTO_TEST_CASE( grid_conversion2 ) +{ + MGrid3f g3(7,13,11); + MGrid1f g1(100); + + for(unsigned i = 0; i < 7; i++) + for(unsigned j = 0; j < 13; j++) + for(unsigned k = 0; k < 11; k++) { + g3[i][j][k] = i+j+k; + } + + for(unsigned i = 0; i < 100; i++) { + g1(i) = i; + } + + Grid3f cpu3(g3); + Grid1f cpu1 = g1.cpu(); + + float sum3 = thrust::reduce(thrust::host, cpu3.data(), cpu3.data()+cpu3.size()); + BOOST_CHECK_EQUAL(sum3,14014); + + float sum1 = thrust::reduce(thrust::host, cpu1.data(), cpu1.data()+cpu1.size()); + BOOST_CHECK_EQUAL(sum1,4950); + + MGrid6d g6(3,4,5,2,1,10); + g6[2][2][2][0][0][5] = 3.14; + Grid6d cpu6 = (Grid6d)g6; //cast conversion + BOOST_CHECK_EQUAL(cpu6.size(),1200); + BOOST_CHECK_EQUAL(cpu6(2,2,2,0,0,5), 3.14); + + Grid6dCUDA gpu6 = (Grid6dCUDA)g6; + double *cudaptr = gpu6.address(2,2,2,0,0,5); + double val = 0; + cudaMemcpy(&val, cudaptr, sizeof(double), cudaMemcpyDeviceToHost); + BOOST_CHECK_EQUAL(val, 3.14); + +} diff --git a/test/test_transform.cpp b/test/test_transform.cpp index 88976fd1..bc63f64d 100644 --- a/test/test_transform.cpp +++ b/test/test_transform.cpp @@ -8,8 +8,6 @@ #define BOOST_TEST_MODULE transform_test #include #include -#include -#include #include "libmolgrid/libmolgrid.h" #include "libmolgrid/transform.h"