Skip to content

Commit

Permalink
Merge pull request #51 from ECP-VeloC/cuda
Browse files Browse the repository at this point in the history
add option to encode/decode with cuda
  • Loading branch information
adammoody authored Nov 18, 2023
2 parents d9760b2 + 3f7e8a6 commit 8f368e1
Show file tree
Hide file tree
Showing 10 changed files with 2,523 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ jobs:
with:
os: ${{ matrix.os }}

#- name: get nvcc (Linux)
# if: startsWith(matrix.os, 'ubuntu')
# shell: bash
# run: |
# sudo apt-get install nvidia-cuda-toolkit

- name: install kvtree
uses: ecp-veloc/github-actions/build-ecp-veloc-component@main
with:
Expand Down
20 changes: 19 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.14)
PROJECT(REDSET VERSION 0.3.0)

# Mac rpath Policy
IF(POLICY CMP0042)
Expand Down Expand Up @@ -27,9 +26,18 @@ else()
endif()
MESSAGE(STATUS "REDSET_LINK_STATIC: ${REDSET_LINK_STATIC}")

OPTION(ENABLE_CUDA "Whether to enable CUDA support" OFF)
MESSAGE(STATUS "ENABLE_CUDA: ${ENABLE_CUDA}")

OPTION(ENABLE_TESTS "Whether to build tests" ON)
MESSAGE(STATUS "ENABLE_TESTS: ${ENABLE_TESTS}")

IF(ENABLE_CUDA)
PROJECT(REDSET VERSION 0.3.0 LANGUAGES C CUDA)
ELSE(ENABLE_CUDA)
PROJECT(REDSET VERSION 0.3.0 LANGUAGES C)
ENDIF(ENABLE_CUDA)

# Find Packages & Files

LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
Expand All @@ -49,6 +57,16 @@ LIST(APPEND REDSET_EXTERNAL_STATIC_LIBS rankstr::rankstr-static)
## MPI
INCLUDE(SetupMPI)
IF(MPI_C_FOUND)
IF(ENABLE_CUDA)
# HACK: IBM MPI compiler wrappers add -pthread, which trips up nvcc.
# A work around is to just drop it.
GET_TARGET_PROPERTY(MPI_C_TMP MPI::MPI_C INTERFACE_LINK_LIBRARIES)
STRING(REPLACE " -pthread" "" MPI_C_TMP "${MPI_C_TMP}")
SET_TARGET_PROPERTIES(MPI::MPI_C PROPERTIES
INTERFACE_LINK_LIBRARIES "${MPI_C_TMP}"
)
ENDIF(ENABLE_CUDA)

LIST(APPEND REDSET_EXTERNAL_LIBS MPI::MPI_C)
LIST(APPEND REDSET_EXTERNAL_STATIC_LIBS MPI::MPI_C)
ELSE(MPI_C_FOUND)
Expand Down
14 changes: 12 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,21 @@ LIST(APPEND libredset_srcs
redset.c
redset_single.c
redset_partner.c
redset_xor.c
redset_reedsolomon_common.c
redset_reedsolomon.c
)

IF(ENABLE_CUDA)
LIST(APPEND libredset_srcs
redset_xor.cu
redset_reedsolomon.cu
)
ELSE(ENABLE_CUDA)
LIST(APPEND libredset_srcs
redset_xor.c
redset_reedsolomon.c
)
ENDIF(ENABLE_CUDA)

IF(BUILD_SHARED_LIBS)
# REDSET Library
ADD_LIBRARY(redset_o OBJECT ${libredset_srcs})
Expand Down
8 changes: 8 additions & 0 deletions src/redset_internal.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef REDSET_INTERNAL_H
#define REDSET_INTERNAL_H

#ifdef __cplusplus
extern "C" {
#endif

#include "kvtree.h"

#include "redset.h"
Expand Down Expand Up @@ -281,4 +285,8 @@ redset_list* redset_filelist_get_rs(
redset_base* d
);

#ifdef __cplusplus
} /* extern C */
#endif

#endif /* REDSET_INTERNAL_H */
8 changes: 8 additions & 0 deletions src/redset_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
/** \name Basic File I/O */
///@{

#ifdef __cplusplus
extern "C" {
#endif

/** returns user's current mode as determine by his umask */
mode_t redset_getmode(int read, int write, int execute);

Expand Down Expand Up @@ -128,4 +132,8 @@ int redset_compress(const char* file_src, const char* file_dst, unsigned long bl
int redset_uncompress(const char* file_src, const char* file_dst);
///@}

#ifdef __cplusplus
} /* extern C */
#endif

#endif
8 changes: 8 additions & 0 deletions src/redset_lofi.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef REDSET_LOFI_H
#define REDSET_LOFI_H

#ifdef __cplusplus
extern "C" {
#endif

/* structure to track an ordered set of files and operate on
* them as one logical, continuous file */
typedef struct {
Expand Down Expand Up @@ -48,4 +52,8 @@ int redset_lofi_apply_meta_mapped(kvtree* hash, const kvtree* map);
/* given a hash that defines a set of files, apply metadata recorded to each file */
int redset_lofi_apply_meta(kvtree* hash);

#ifdef __cplusplus
} /* extern C */
#endif

#endif /* REDSET_LOFI_H */
Loading

0 comments on commit 8f368e1

Please sign in to comment.