Files
LBPM/tests/TestSetDevice.cpp

36 lines
836 B
C++
Raw Normal View History

2020-06-27 15:16:13 -04:00
#include <iostream>
2021-01-06 11:58:43 -05:00
#include "common/MPI.h"
2020-06-27 15:16:13 -04:00
#include "common/Utilities.h"
#include "common/ScaLBL.h"
int main (int argc, char **argv)
2021-01-06 11:58:43 -05:00
{
Utilities::startup( argc, argv );
Utilities::MPI comm( MPI_COMM_WORLD );
int rank = comm.getRank();
int nprocs = comm.getSize();
2020-06-27 15:16:13 -04:00
for (int i=0; i<nprocs; i++) {
if ( rank==i )
printf("%i of %i: Hello world\n",rank,nprocs);
2021-01-06 11:58:43 -05:00
comm.barrier();
2020-06-27 15:16:13 -04:00
}
// Initialize compute device
ScaLBL_SetDevice(rank);
ScaLBL_DeviceBarrier();
2021-01-06 11:58:43 -05:00
comm.barrier();
2020-06-27 15:16:13 -04:00
// 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;
2021-01-06 11:58:43 -05:00
Utilities::shutdown();
2020-06-27 15:16:13 -04:00
return error;
}