Skip to content

Commit 4674cfa

Browse files
committed
Rearrange thrust includes for CUDA 12.5 compat
1 parent 921de63 commit 4674cfa

3 files changed

Lines changed: 38 additions & 42 deletions

File tree

test/test_mgrid.cpp

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77

88
#define BOOST_TEST_MODULE grid_test
99
#include <boost/test/unit_test.hpp>
10-
#include <thrust/reduce.h>
11-
#include <thrust/execution_policy.h>
12-
1310
#include "libmolgrid/managed_grid.h"
1411

1512
using namespace libmolgrid;
@@ -88,43 +85,6 @@ BOOST_AUTO_TEST_CASE( indirect_indexing )
8885

8986
}
9087

91-
BOOST_AUTO_TEST_CASE( grid_conversion )
92-
{
93-
MGrid3f g3(7,13,11);
94-
MGrid1f g1(100);
95-
96-
for(unsigned i = 0; i < 7; i++)
97-
for(unsigned j = 0; j < 13; j++)
98-
for(unsigned k = 0; k < 11; k++) {
99-
g3[i][j][k] = i+j+k;
100-
}
101-
102-
for(unsigned i = 0; i < 100; i++) {
103-
g1(i) = i;
104-
}
105-
106-
Grid3f cpu3(g3);
107-
Grid1f cpu1 = g1.cpu();
108-
109-
float sum3 = thrust::reduce(thrust::host, cpu3.data(), cpu3.data()+cpu3.size());
110-
BOOST_CHECK_EQUAL(sum3,14014);
111-
112-
float sum1 = thrust::reduce(thrust::host, cpu1.data(), cpu1.data()+cpu1.size());
113-
BOOST_CHECK_EQUAL(sum1,4950);
114-
115-
MGrid6d g6(3,4,5,2,1,10);
116-
g6[2][2][2][0][0][5] = 3.14;
117-
Grid6d cpu6 = (Grid6d)g6; //cast conversion
118-
BOOST_CHECK_EQUAL(cpu6.size(),1200);
119-
BOOST_CHECK_EQUAL(cpu6(2,2,2,0,0,5), 3.14);
120-
121-
Grid6dCUDA gpu6 = (Grid6dCUDA)g6;
122-
double *cudaptr = gpu6.address(2,2,2,0,0,5);
123-
double val = 0;
124-
cudaMemcpy(&val, cudaptr, sizeof(double), cudaMemcpyDeviceToHost);
125-
BOOST_CHECK_EQUAL(val, 3.14);
126-
127-
}
12888

12989

13090
BOOST_AUTO_TEST_CASE( blank_mgrid )

test/test_mgrid.cu

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,41 @@ BOOST_AUTO_TEST_CASE( grid_conversion )
6060
cudaError_t error = cudaGetLastError();
6161
BOOST_CHECK_EQUAL(error,cudaSuccess);
6262
}
63+
64+
BOOST_AUTO_TEST_CASE( grid_conversion2 )
65+
{
66+
MGrid3f g3(7,13,11);
67+
MGrid1f g1(100);
68+
69+
for(unsigned i = 0; i < 7; i++)
70+
for(unsigned j = 0; j < 13; j++)
71+
for(unsigned k = 0; k < 11; k++) {
72+
g3[i][j][k] = i+j+k;
73+
}
74+
75+
for(unsigned i = 0; i < 100; i++) {
76+
g1(i) = i;
77+
}
78+
79+
Grid3f cpu3(g3);
80+
Grid1f cpu1 = g1.cpu();
81+
82+
float sum3 = thrust::reduce(thrust::host, cpu3.data(), cpu3.data()+cpu3.size());
83+
BOOST_CHECK_EQUAL(sum3,14014);
84+
85+
float sum1 = thrust::reduce(thrust::host, cpu1.data(), cpu1.data()+cpu1.size());
86+
BOOST_CHECK_EQUAL(sum1,4950);
87+
88+
MGrid6d g6(3,4,5,2,1,10);
89+
g6[2][2][2][0][0][5] = 3.14;
90+
Grid6d cpu6 = (Grid6d)g6; //cast conversion
91+
BOOST_CHECK_EQUAL(cpu6.size(),1200);
92+
BOOST_CHECK_EQUAL(cpu6(2,2,2,0,0,5), 3.14);
93+
94+
Grid6dCUDA gpu6 = (Grid6dCUDA)g6;
95+
double *cudaptr = gpu6.address(2,2,2,0,0,5);
96+
double val = 0;
97+
cudaMemcpy(&val, cudaptr, sizeof(double), cudaMemcpyDeviceToHost);
98+
BOOST_CHECK_EQUAL(val, 3.14);
99+
100+
}

test/test_transform.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#define BOOST_TEST_MODULE transform_test
99
#include <boost/test/unit_test.hpp>
1010
#include <boost/test/tools/floating_point_comparison.hpp>
11-
#include <thrust/reduce.h>
12-
#include <thrust/execution_policy.h>
1311

1412
#include "libmolgrid/libmolgrid.h"
1513
#include "libmolgrid/transform.h"

0 commit comments

Comments
 (0)