at device test
This commit is contained in:
parent
1a5b46156d
commit
07ea37d2f2
@ -70,6 +70,7 @@ ADD_LBPM_TEST_PARALLEL( TestCommD3Q19 8 )
|
|||||||
ADD_LBPM_TEST_1_2_4( testCommunication )
|
ADD_LBPM_TEST_1_2_4( testCommunication )
|
||||||
ADD_LBPM_TEST( TestWriter )
|
ADD_LBPM_TEST( TestWriter )
|
||||||
ADD_LBPM_TEST( TestDatabase )
|
ADD_LBPM_TEST( TestDatabase )
|
||||||
|
ADD_LBPM_TEST( TestSetDevice )
|
||||||
ADD_LBPM_PROVISIONAL_TEST( TestMicroCTReader )
|
ADD_LBPM_PROVISIONAL_TEST( TestMicroCTReader )
|
||||||
IF ( USE_NETCDF )
|
IF ( USE_NETCDF )
|
||||||
ADD_LBPM_TEST_PARALLEL( TestNetcdf 8 )
|
ADD_LBPM_TEST_PARALLEL( TestNetcdf 8 )
|
||||||
|
37
tests/TestSetDevice.cpp
Normal file
37
tests/TestSetDevice.cpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include "common/MPI_Helpers.h"
|
||||||
|
#include "common/Utilities.h"
|
||||||
|
#include "common/ScaLBL.h"
|
||||||
|
|
||||||
|
int main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
MPI_Init(&argc,&argv);
|
||||||
|
int rank = MPI_WORLD_RANK();
|
||||||
|
int nprocs = MPI_WORLD_SIZE();
|
||||||
|
|
||||||
|
for (int i=0; i<nprocs; i++) {
|
||||||
|
if ( rank==i )
|
||||||
|
printf("%i of %i: Hello world\n",rank,nprocs);
|
||||||
|
MPI_Barrier(MPI_COMM_WORLD);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize compute device
|
||||||
|
ScaLBL_SetDevice(rank);
|
||||||
|
ScaLBL_DeviceBarrier();
|
||||||
|
MPI_Barrier(comm);
|
||||||
|
|
||||||
|
// Create a memory leak for valgrind to find
|
||||||
|
if ( nprocs==1 ) {
|
||||||
|
double *x = new double[1];
|
||||||
|
ASSERT(x!=NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the error code
|
||||||
|
// Note: the error code should be consistent across all processors
|
||||||
|
int error = 0;
|
||||||
|
|
||||||
|
// Finished
|
||||||
|
MPI_Barrier(MPI_COMM_WORLD);
|
||||||
|
MPI_Finalize();
|
||||||
|
return error;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user