Skip to content

Commit ecee70b

Browse files
author
Alessandro Fanfarillo
committed
New makefile for cuda_mpi and minor changes
Signed-off-by: Alessandro Fanfarillo <[email protected]>
1 parent 1db946c commit ecee70b

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

src/cuda_mpi/Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
include ../make.inc
2+
3+
MPICC ?= cc
4+
5+
libcaf_cuda.a: mpi_caf.o ../common/caf_auxiliary.o
6+
ar rcv $@ mpi_caf.o ../common/caf_auxiliary.o
7+
ranlib $@
8+
9+
.c.o:
10+
$(MPICC) $(CFLAGS) $(MPI_CFLAGS) -I.. -I/opt/nvidia/cudatoolkit6.5/6.5.14-1.0502.9836.9.1/include/ -L/opt/nvidia/cudatoolkit6.5/6.5.14-1.0502.9836.9.1/lib -lcuda -lcudart -c $< -o $@
11+
12+
mpi_caf.o: mpi_caf.c ../libcaf.h ../libcaf-gfortran-descriptor.h
13+
14+
../common/caf_auxiliary.o:
15+
$(MAKE) -C ../common
16+
17+
clean:
18+
rm -f mpi_caf.o
19+
20+
distclean: clean
21+
rm -f libcaf_mpi.a

src/cuda_mpi/mpi_caf.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
4141
#include <unistd.h>
4242
#include <mpi.h>
4343
#include <pthread.h>
44-
44+
#include "cuda_runtime_api.h"
4545
#include "libcaf.h"
4646

4747
/* Define GFC_CAF_CHECK to enable run-time checking. */
@@ -477,8 +477,8 @@ PREFIX(registernc) (void* mem,size_t mem_size)
477477
cuda_ierr = cudaHostRegister(mem,mem_size,cudaHostRegisterMapped);
478478
cudaDeviceSynchronize();
479479

480-
if (ierr != 0)
481-
call caf_runtime_error ("CUDA allocation failed with code %d", ierr);
480+
if (cuda_ierr != 0)
481+
caf_runtime_error ("CUDA allocation failed with code %d", cuda_ierr);
482482

483483
return;
484484

0 commit comments

Comments
 (0)