Skip to content

Commit 74df774

Browse files
authored
Feature ior gpu #284 (#323)
* Basic support for memory allocation on GPU using CUDA unified memory. Partially addressing #284. IOR support completed. * Support for GPU alloc in MDTest and MD-Workbench * Option: support repeated parsing of same option (allows option sharing across modules). * Checks for gpuDirect * Integrate gpuDirect options and basic hooks, more testing to be done. * POSIX: basic gpuDirect implementation working with fake-gpudirect library. * CUDA allow setting of DeviceID for IOR (not yet MDTest). * CUDA/GPUDirect Support --with-X=<path> * Bugfix in option parser for flags that are part of an argument for an option, e.g., -O=1, if 1 is a flag it is wrongly assumed to be a flag.
1 parent e78613d commit 74df774

12 files changed

+338
-119
lines changed

configure.ac

+46
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,52 @@ AS_IF([test "$ac_cv_header_gpfs_h" = "yes" -o "$ac_cv_header_gpfs_fcntl_h" = "ye
7373
])
7474
])
7575

76+
# Check for CUDA
77+
AC_ARG_WITH([cuda],
78+
[AS_HELP_STRING([--with-cuda],
79+
[support configurable CUDA @<:@default=check@:>@])],
80+
[], [with_cuda=check])
81+
82+
AS_IF([test "x$with_cuda" != xno], [
83+
LDFLAGS="$LDFLAGS -L$with_cuda/lib64 -Wl,--enable-new-dtags -Wl,-rpath=$with_cuda/lib64"
84+
CPPFLAGS="$CPPFLAGS -I$with_cuda/include"
85+
86+
AC_CHECK_HEADERS([cuda_runtime.h], [AC_DEFINE([HAVE_CUDA], [], [CUDA GPU API found])], [
87+
if test "x$with_cuda" != xcheck; then
88+
AC_MSG_FAILURE([--with-cuda was given, <cuda_runtime.h> not found])
89+
fi
90+
])
91+
AS_IF([test "$ac_cv_header_cuda_runtime_h" = "yes"], [
92+
AC_SEARCH_LIBS([cudaMalloc], [cudart cudart_static], [],
93+
[AC_MSG_ERROR([Library containing cudaMalloc symbol not found])])
94+
])
95+
])
96+
AM_CONDITIONAL([USE_CUDA], [test x$with_cuda = xyes])
97+
98+
# Check for GPUDirect
99+
AC_ARG_WITH([gpuDirect],
100+
[AS_HELP_STRING([--with-gpuDirect],
101+
[support configurable GPUDirect @<:@default=check@:>@])],
102+
[], [with_gpuDirect=check])
103+
104+
AS_IF([test "x$with_gpuDirect" != xno], [
105+
LDFLAGS="$LDFLAGS -L$with_gpuDirect/lib64 -Wl,--enable-new-dtags -Wl,-rpath=$with_gpuDirect/lib64"
106+
CPPFLAGS="$CPPFLAGS -I$with_gpuDirect/include"
107+
108+
AC_CHECK_HEADERS([cufile.h], [AC_DEFINE([HAVE_GPU_DIRECT], [], [GPUDirect API found])], [
109+
if test "x$with_gpuDirect" != xcheck; then
110+
AC_MSG_FAILURE([--with-gpuDirect was given, <cufile.h> not found])
111+
fi
112+
])
113+
AS_IF([test "$ac_cv_header_cufile_h" = "yes"], [
114+
AC_SEARCH_LIBS([cuFileDriverOpen], [cufile], [],
115+
[AC_MSG_ERROR([Library containing cuFileDriverOpen symbol not found])])
116+
])
117+
])
118+
AM_CONDITIONAL([HAVE_GPU_DIRECT], [test x$with_gpuDirect = xyes])
119+
120+
121+
76122
# Check for system capabilities
77123
AC_SYS_LARGEFILE
78124

src/Makefile.am

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ extraLDFLAGS += -L/opt/hadoop-2.2.0/lib/native
4141
extraLDADD += -lhdfs
4242
endif
4343

44+
if USE_CUDA
45+
extraLDADD += -lcudart
46+
endif
47+
4448
if USE_HDF5_AIORI
4549
extraSOURCES += aiori-HDF5.c
4650
extraLDADD += -lhdf5 -lz

0 commit comments

Comments
 (0)