Compare commits

...

12 Commits

Author SHA1 Message Date
John Ravi
d674a5d644 Merge branch 'develop' into cu_dev 2020-09-28 11:47:52 -07:00
John Ravi
6062930447 updating README 2020-09-28 10:55:09 -07:00
John Ravi
4c5bef48a7 add io block size parameter for GDS VFD 2020-09-04 18:14:10 -07:00
John Ravi
ec14e52bb6 replaced GDS support preprocessor macro to a standardized format 2020-09-04 12:19:19 -07:00
John Ravi
8160e61280 remove outdated TODO comment 2020-09-02 06:55:50 -07:00
John Ravi
62636cb935 IO 4K per thread bug fix 2020-09-02 04:12:11 -07:00
John Ravi
db51b399f0 1. use io threads for gds
2. temp fix open cu file driver only once
2020-09-01 12:31:48 -07:00
John Ravi
8a87477e22 adding profiling code 2020-08-26 17:38:46 -07:00
John Ravi
1a8bdc93ab Merge remote-tracking branch 'origin/develop' into cu_dev 2020-07-05 18:56:27 -07:00
John Ravi
88d1a34b65 created gds vfd, removed changes to sec2 2020-07-05 18:53:36 -07:00
John Ravi
c8f5739b88 initial support for cuda cufile api 2020-07-01 05:49:12 -07:00
John Ravi
db4c96e13d starting to integrate cuda api 2020-06-23 05:34:53 -07:00
10 changed files with 1642 additions and 4 deletions

View File

@@ -16,6 +16,12 @@ project, tools and services can be found at the Group's website.
https://www.hdfgroup.org/ https://www.hdfgroup.org/
PURPOSE of cu_dev
------------------
The motivation of cu_dev is to interface with Nvidia's GPUDirect Storage (GDS)
API through a HDF5 VFD. You need to configure the hdf5 build with both
--with-cuda and --with-gds to enable the GDS VFD.
DOCUMENTATION DOCUMENTATION
------------- -------------

View File

@@ -1363,6 +1363,43 @@ AC_ARG_WITH([fnord],
include/ and lib/ subdirectories include/ and lib/ subdirectories
]) ])
####################### CUDA #######################
AC_SUBST([ENABLE_CUDA])
AC_SUBST([GDS_VFD])
## Default is not present
ENABLE_CUDA=no
GDS_VFD=no
m4_include([cuda.ac])
if test -n "$CUDA_DIR"; then
CPPFLAGS="$CPPFLAGS -I$CUDA_DIR/include"
AM_CPPFLAGS="$AM_CPPFLAGS -I$CUDA_DIR/include"
fi
if test -n "$CUDA_LIBS"; then
LDFLAGS="$LDFLAGS -L$CUDA_DIR/lib64 $CUDA_LIBS"
AM_LDFLAGS="$AM_LDFLAGS -L$CUDA_DIR/lib64 $CUDA_LIBS"
fi
if test -n "$CUFILE_DIR"; then
if test x$ENABLE_CUDA = xyes; then
GDS_VFD=yes
AC_DEFINE([GDS_SUPPORT], [1], [Define if support for gds (cufile) is enabled])
else
GDS_VFD=no
AC_MSG_ERROR([GDS VFD was requested but missing cuda path, verify --with-cuda=])
fi
CPPFLAGS="$CPPFLAGS -I$CUFILE_DIR/lib"
AM_CPPFLAGS="$AM_CPPFLAGS -I$CUFILE_DIR/lib"
LDFLAGS="$LDFLAGS -L$CUFILE_DIR/lib -lcufile"
AM_LDFLAGS="$AM_LDFLAGS -L$CUFILE_DIR/lib -lcufile"
fi
##################### END CUDA #####################
## ---------------------------------------------------------------------- ## ----------------------------------------------------------------------
## Is dmalloc (debug malloc library) requested? It has a header file ## Is dmalloc (debug malloc library) requested? It has a header file
## `dmalloc.h' and a library `-ldmalloc' and their locations might be ## `dmalloc.h' and a library `-ldmalloc' and their locations might be

59
cuda.ac Normal file
View File

@@ -0,0 +1,59 @@
#
########################################################
# Allow setting CUDA compute capability at `configure`-time.
AC_ARG_WITH([cuda-level],
[AS_HELP_STRING(
[--with-cuda-level=LEVEL],
[use CUDA compute capability LEVEL])],
[CUDA_LEVEL=$withval],
[CUDA_LEVEL=70])
AC_ARG_WITH([cuda],
[AS_HELP_STRING([--with-cuda@<:@=PATH@:>@],
[use CUDA (installed in PATH) @<:@no@:>@])],
[CUDA_DIR=$withval],
[CUDA_DIR="no"])
# We also support using the argument "auto" to mean "yes"
case x$CUDA_DIR in
xno) ENABLE_CUDA=no ;;
x|xauto|xyes) ENABLE_CUDA=yes ;;
*) ENABLE_CUDA=yes ;;
esac
if test x$ENABLE_CUDA = xyes; then
AC_PATH_PROG([NVCC_PATH],nvcc,[],[$CUDA_DIR/bin])
if test -z "$NVCC_PATH" ; then
AC_MSG_ERROR(['bin/nvcc' not found in $CUDA_DIR/bin])
fi
AC_CONFIG_FILES([cuda.mk])
fi
# Some CUDA installs only use the runtime library, so test for the presence of each
if test x$ENABLE_CUDA = xyes; then
if test -e $CUDA_DIR/lib64/libcuda.so; then
CUDA_LIBS=-lcuda
else
if test -e $CUDA_DIR/lib64/libcudart.so; then
CUDA_LIBS=-lcudart
else
>&2 echo Could not find libcuda[rt].so
exit 1
fi
fi
fi
AC_ARG_WITH([cufile],
[AS_HELP_STRING([--with-cufile=DIR],
[Beta. Might change in the future.])],
[CUFILE_DIR=$withval],
[withval=no])
AC_SUBST([ENABLE_CUDA])
AC_SUBST([CUDA_LEVEL])
AC_SUBST([CUDA_DIR])
AC_SUBST([NVCC_PATH])
AC_SUBST([CUDA_LIBS])
AC_SUBST([CUFILE_DIR])

48
cuda.mk.in Normal file
View File

@@ -0,0 +1,48 @@
# Turn on if outer variable is set. Otherwise, allow user to set explicitly.
CUDA_DEBUG = $(DEBUG)
CUDA_VERBOSE = $(VERBOSE)
cuda_includes := -I@CUDA_DIR@/include
#cuda_srcs := $(srcdir)/src/H5FDsec2.c
cuda_libs := @CUDA_LIBS@
cuda_ldflags += -L@CUDA_DIR@/lib64
cuda_objs := $(patsubst %.cu,%.o,$(subst $(srcdir),$(build_dir),$(cuda_srcs)))
# For more details on the architectures, see
# http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#virtual-architecture-feature-list
nvcc_flags += -arch=compute_@CUDA_LEVEL@ -code=sm_@CUDA_LEVEL@
# nvcc includes are broken when the host compiler is gcc >= 5.0
nvcc_flags += -D_FORCE_INLINES
ifeq (1,$(CUDA_VERBOSE))
nvcc_flags += --ptxas-options=-v
endif
ifeq (1,$(CUDA_DEBUG))
nvcc_flags += --device-debug
else
nvcc_flags += -use_fast_math
endif
.PHONY: show-config
show-config: cuda-show-config
.PHONY: cuda-show-config
cuda-show-config:
@ echo NVCC_FLAGS = $(nvcc_flags)"\n"
@ echo CUDA_DEFINES = $(cuda_defines)"\n"
@ echo CUDA_INCLUDES = $(cuda_includes)"\n"
@ echo CUDA_LDFLAGS = $(cuda_ldflags)"\n"
@ echo CUDA_LIBS = $(cuda_libs)"\n"
.PHONY: dist-clean
dist-clean: cuda-dist-clean
.PHONY: cuda-dist-clean
cuda-dist-clean:
@ $(RM) cuda.mk
$(build_dir)/%.o: $(srcdir)/src/%.cu
@ echo Compiling $<...
$(quiet) @NVCC_PATH@ -std=$(cxx_std) -Xcompiler "$(cxx_flags) $(depend_flags) $(depend_dir)/$*$(depend_suffix)" $(nvcc_flags) -c $< -o $@

1413
src/H5FDgds.c Normal file

File diff suppressed because it is too large Load Diff

63
src/H5FDgds.h Normal file
View File

@@ -0,0 +1,63 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Programmer: John Ravi <jjravi@lbl.gov>
* Wednesday, July 1, 2020
*
* Purpose: The public header file for the CUDA GPUDirect Storage driver.
*/
#ifndef H5FDgds_H
#define H5FDgds_H
#define H5FD_GDS (H5FD_gds_init())
#define check_cudadrivercall(fn) \
do { \
CUresult res = fn; \
if (res != CUDA_SUCCESS) { \
const char *str = nullptr; \
cuGetErrorName(res, &str); \
fprintf(stderr, "cuda driver api call failed %d, %d : %s\n", fn, \
__LINE__, str); \
fprintf(stderr, "EXITING program!!!\n"); \
exit(1); \
} \
} while(0)
#define check_cudaruntimecall(fn) \
do { \
cudaError_t res = fn; \
if (res != cudaSuccess) { \
const char *str = cudaGetErrorName(res); \
fprintf(stderr, "cuda runtime api call failed %d, %d : %s\n", fn, \
__LINE__, str); \
fprintf(stderr, "EXITING program!!!\n"); \
exit(1); \
} \
} while(0)
/* Function prototypes */
#ifdef __cplusplus
extern "C" {
#endif
H5_DLL hid_t H5FD_gds_init(void);
H5_DLL herr_t H5Pset_fapl_gds(hid_t fapl_id);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -61,8 +61,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5lib_settings.c H5system.c \
H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \ H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \
H5FA.c H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \ H5FA.c H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \
H5FAint.c H5FAstat.c H5FAtest.c \ H5FAint.c H5FAstat.c H5FAtest.c \
H5FD.c H5FDcore.c H5FDfamily.c H5FDhdfs.c H5FDint.c H5FDlog.c \ H5FD.c H5FDcore.c H5FDfamily.c H5FDgds.c H5FDhdfs.c H5FDint.c \
H5FDmulti.c H5FDsec2.c H5FDspace.c \ H5FDlog.c H5FDmulti.c H5FDsec2.c H5FDspace.c \
H5FDsplitter.c H5FDstdio.c H5FDtest.c \ H5FDsplitter.c H5FDstdio.c H5FDtest.c \
H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSint.c H5FSsection.c \ H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSint.c H5FSsection.c \
H5FSstat.c H5FStest.c \ H5FSstat.c H5FStest.c \
@@ -141,7 +141,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers
H5Apublic.h H5ACpublic.h \ H5Apublic.h H5ACpublic.h \
H5Cpublic.h H5Dpublic.h \ H5Cpublic.h H5Dpublic.h \
H5Epubgen.h H5Epublic.h H5ESpublic.h H5Fpublic.h \ H5Epubgen.h H5Epublic.h H5ESpublic.h H5Fpublic.h \
H5FDpublic.h H5FDcore.h H5FDdirect.h H5FDfamily.h H5FDhdfs.h \ H5FDpublic.h H5FDcore.h H5FDdirect.h H5FDfamily.h H5FDgds.h H5FDhdfs.h \
H5FDlog.h H5FDmirror.h H5FDmpi.h H5FDmpio.h H5FDmulti.h H5FDros3.h \ H5FDlog.h H5FDmirror.h H5FDmpi.h H5FDmpio.h H5FDmulti.h H5FDros3.h \
H5FDsec2.h H5FDsplitter.h H5FDstdio.h H5FDwindows.h \ H5FDsec2.h H5FDsplitter.h H5FDstdio.h H5FDwindows.h \
H5Gpublic.h H5Ipublic.h H5Lpublic.h \ H5Gpublic.h H5Ipublic.h H5Lpublic.h \

View File

@@ -44,6 +44,7 @@
#include "H5FDcore.h" /* Files stored entirely in memory */ #include "H5FDcore.h" /* Files stored entirely in memory */
#include "H5FDdirect.h" /* Linux direct I/O */ #include "H5FDdirect.h" /* Linux direct I/O */
#include "H5FDfamily.h" /* File families */ #include "H5FDfamily.h" /* File families */
#include "H5FDgds.h" /* CUDA GPUDirect Storage cufile I/O */
#include "H5FDhdfs.h" /* Hadoop HDFS */ #include "H5FDhdfs.h" /* Hadoop HDFS */
#include "H5FDlog.h" /* sec2 driver with I/O logging (for debugging) */ #include "H5FDlog.h" /* sec2 driver with I/O logging (for debugging) */
#include "H5FDmirror.h" /* Mirror VFD and IPC definitions */ #include "H5FDmirror.h" /* Mirror VFD and IPC definitions */

View File

@@ -64,6 +64,12 @@ Languages:
Java: @HDF_JAVA@ Java: @HDF_JAVA@
@BUILD_JAVA_CONDITIONAL_TRUE@ Java Compiler: @JAVA_VERSION@ @BUILD_JAVA_CONDITIONAL_TRUE@ Java Compiler: @JAVA_VERSION@
CUDA Options:
-------------
Toolkit directory: @CUDA_DIR@
nvcc path: @NVCC_PATH@
Link libraries: @CUDA_LIBS@
Compute level: @CUDA_LEVEL@
Features: Features:
--------- ---------
@@ -83,6 +89,7 @@ Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@
Mirror VFD: @MIRROR_VFD@ Mirror VFD: @MIRROR_VFD@
(Read-Only) S3 VFD: @ROS3_VFD@ (Read-Only) S3 VFD: @ROS3_VFD@
(Read-Only) HDFS VFD: @HAVE_LIBHDFS@ (Read-Only) HDFS VFD: @HAVE_LIBHDFS@
GDS VFD: @GDS_VFD@
dmalloc: @HAVE_DMALLOC@ dmalloc: @HAVE_DMALLOC@
Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@ Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@
API tracing: @TRACE_API@ API tracing: @TRACE_API@

View File

@@ -963,6 +963,10 @@ h5_get_vfd_fapl(hid_t fapl)
/* POSIX (section 2) read() and write() system calls */ /* POSIX (section 2) read() and write() system calls */
if(H5Pset_fapl_sec2(fapl) < 0) if(H5Pset_fapl_sec2(fapl) < 0)
goto error; goto error;
} else if(!HDstrcmp(tok, "gds")) {
/* Standard C fread() and fwrite() system calls */
if(H5Pset_fapl_gds(fapl) < 0)
goto error;
} else if(!HDstrcmp(tok, "stdio")) { } else if(!HDstrcmp(tok, "stdio")) {
/* Standard C fread() and fwrite() system calls */ /* Standard C fread() and fwrite() system calls */
if(H5Pset_fapl_stdio(fapl) < 0) if(H5Pset_fapl_stdio(fapl) < 0)
@@ -1383,7 +1387,7 @@ h5_get_file_size(const char *filename, hid_t fapl)
return(-1); return(-1);
/* Check for simple cases */ /* Check for simple cases */
if(driver == H5FD_SEC2 || driver == H5FD_STDIO || driver == H5FD_CORE || if(driver == H5FD_SEC2 || driver == H5FD_GDS || driver == H5FD_STDIO || driver == H5FD_CORE ||
#ifdef H5_HAVE_WINDOWS #ifdef H5_HAVE_WINDOWS
driver == H5FD_WINDOWS || driver == H5FD_WINDOWS ||
#endif /* H5_HAVE_WINDOWS */ #endif /* H5_HAVE_WINDOWS */