Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 9e237801 authored by hhakim's avatar hhakim
Browse files

Start new MatDense<FPP,GPU2> impl. using GPU_MOD (to replace later MatDense<FPP,GPU>.

parent 700297ac
Branches
Tags
No related merge requests found
......@@ -424,6 +424,10 @@ if (BUILD_USE_GPU)
set(FAUST_SRC_TEST_GPU_DIR ${FAUST_MISC_DIR}/test/GPU_test CACHE INTERNAL "")
set(FAUST_BIN_TEST_GPU_DIR ${FAUST_BIN_TEST_DIR}/binGPU CACHE INTERNAL "")
endif(BUILD_USE_GPU)
if (USE_GPU_MOD)
set(FAUST_SRC_LINEAR_OPERATOR_GPU2_DIR ${FAUST_SRC_LINEAR_OPERATOR_DIR}/GPU2 CACHE INTERNAL "")
set(FAUST_BIN_LINEAR_OPERATOR_GPU2_DIR ${FAUST_BIN_LINEAR_OPERATOR_DIR}/GPU2 CACHE INTERNAL "")
endif(USE_GPU_MOD)
##################################################################
###### DOCUMENTATION DIRECTORIES ######
......@@ -615,6 +619,7 @@ if(USE_GPU_MOD)
set(GM_SCALAR double)
set(GM_REINTERPRET_CAST_SCALAR double)
configure_file(${FAUST_LINEAR_OPERATOR_CPU_SRC_DIR}/faust_gpu_mod_gen.hpp.in ${FAUST_LINEAR_OPERATOR_CPU_SRC_DIR}/faust_gpu_mod_double.hpp)
configure_file(${FAUST_SRC_LINEAR_OPERATOR_GPU2_DIR}/faust_MatDense_gpu.hpp.in ${FAUST_SRC_LINEAR_OPERATOR_GPU2_DIR}/faust_MatDense_gpu_double.hpp)
set(FAUST_SCALAR_FOR_GM complex<double>)
set(GM_SCALAR cuDoubleComplex)
set(GM_REINTERPRET_CAST_SCALAR double)
......@@ -629,7 +634,7 @@ if(USE_GPU_MOD)
endif()
file(TO_NATIVE_PATH lib/${GPU_MOD_LIB} GPU_MOD_LIB_PATH) # used in setup.py
file(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${GPU_MOD_LIB} GPU_MOD_LIB_INSTALL_PATH) # only for system packages (not for pip package)
# GPU2
endif()
......@@ -731,9 +736,14 @@ endif()
if(USE_GPU_MOD)
include_directories(${FAUST_TARGET} ${GPU_MOD_INCLUDE_DIR} ${GPU_MOD_INCLUDE_DIR}/../build)
include_directories(${FAUST_TARGET} ${FAUST_SRC_LINEAR_OPERATOR_GPU2_DIR})
target_include_directories(${FAUST_TARGET} PUBLIC ${GPU_MOD_INCLUDE_DIR} ${GPU_MOD_INCLUDE_DIR}/../build)
target_link_libraries(${FAUST_TARGET} ${GPU_MOD_LIBS})
if(UNIX)
target_link_libraries(${FAUST_TARGET} dl)
endif(UNIX)
install(FILES ${GPU_MOD_INCLUDE_DIR}/../build/libgm.so DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_EXECUTE WORLD_READ)
include_directories(${FAUST_TARGET} ${FAUST_SRC_LINEAR_OPERATOR_GPU2_DIR})
endif()
# In case of GPU, the "CUDA" library libfaust_matrix_cu.a is linked with faust (libfaust_matrix_cu.a is not a OBJECT library)
......
......@@ -4,7 +4,7 @@ if(BUILD_TESTING)
#${FAUST_EXCEPTION_SRC_DIR}
include_directories(${FAUST_SRC_LINEAR_OPERATOR_DIR} ${FAUST_LINEAR_OPERATOR_CPU_SRC_DIR} ${FAUST_ALGORITHM_CONSTRAINT_SRC_DIR} ${FAUST_ALGORITHM_FACTORIZATION_SRC_DIR} ${EIGEN_INC_DIR} ${FAUST_UTILS_SRC_DIR})
include_directories(${FAUST_SRC_LINEAR_OPERATOR_GPU2_DIR})
if(BUILD_READ_MAT_FILE)
include_directories(${FAUST_CMDLINE_TYPE_FORMAT_MAT_SRC_DIR} ${MATIO_INC_DIR})
endif(BUILD_READ_MAT_FILE)
......@@ -197,17 +197,17 @@ if(MATIO_LIB_FILE AND MATIO_INC_DIR AND BUILD_READ_MAT_FILE AND NOT NOCPPTESTS)
# faust_multiplication : time comparison between Faust-vector product and Dense matrix-vector product
list(APPEND tests hierarchicalFactorization hierarchicalFactorizationFFT test_palm4MSA test_palm4MSAFFT faust_multiplication faust_matdense_conjugate GivensFGFT GivensFGFTSparse GivensFGFTParallel GivensFGFTParallelSparse test_MatDiag faust_matsparse_mul faust_matsparse_index_op GivensFGFTComplex GivensFGFTComplexSparse GivensFGFTParallelComplex faust_toeplitz faust_circ faust_hankel palm4msa_2020 hierarchical2020 hierarchical2020Hadamard hierarchicalFactorizationHadamard)
list(APPEND tests hierarchicalFactorization hierarchicalFactorizationFFT test_palm4MSA test_palm4MSAFFT faust_multiplication faust_matdense_conjugate GivensFGFT GivensFGFTSparse GivensFGFTParallel GivensFGFTParallelSparse test_MatDiag faust_matsparse_mul faust_matsparse_index_op GivensFGFTComplex GivensFGFTComplexSparse GivensFGFTParallelComplex faust_toeplitz faust_circ faust_hankel palm4msa_2020 hierarchical2020 hierarchical2020Hadamard hierarchicalFactorizationHadamard)#MEG_factorization)
if(FAUST_TORCH)
list(APPEND tests faust_torch)
endif()
if(USE_GPU_MOD)
list(APPEND tests faust_gpu_mod hierarchical2020_gpu)
list(APPEND tests faust_gpu_mod hierarchical2020_gpu test_matdense_gpu_mod)
endif()
foreach(TEST_FPP float double complex<float> complex<double>)
foreach(TEST_FPP float double complex<float> complex<double>)
foreach(testin IN LISTS tests)
if(${TEST_FPP} MATCHES complex )
set(TEST_IS_COMPLEX 1)
......
#include "faust_MatDense_gpu2.h"
#include <cstdlib>
using namespace Faust;
int main(int argc, char** argv)
{
MatDense<FPP,GPU2> mat;
return EXIT_SUCCESS;
}
#ifndef __FAUST_MATDENSE_GPU2__
#define __FAUST_MATDENSE_GPU2__
#ifdef USE_GPU_MOD
#include "faust_MatDense.h"
#define __GM_LOADER__
#include "gm_interf.h"
namespace Faust
{
template<typename FPP,FDevice DEVICE>
class MatDense;
template<typename FPP>
class MatDense<FPP, GPU2> : MatDense<FPP, Cpu>
{
public:
MatDense(const FPP* data, const faust_unsigned_int nbRow, const faust_unsigned_int nbCol);
// multiply(const MatDense<Cpu,FPP> &other);
// multiply(const MatSparse<Cpu,FPP> &other);
// multiply(const Vect<Cpu,FPP> &vec);
// multiply(const MatDense<GPU2, FPP> &other);
private:
static void* dsm_funcs;
gm_DenseMat_t gpu_mat;
};
template <typename FPP>
void* Faust::MatDense<FPP,GPU2>::dsm_funcs = nullptr;
};
#include "faust_MatDense_gpu_double.hpp"
#endif
#endif
//TODO: move to CPP
template<>
Faust::MatDense<@FAUST_SCALAR_FOR_GM@,GPU2>::MatDense(const @FAUST_SCALAR_FOR_GM@* data, const faust_unsigned_int nbRow, const faust_unsigned_int nbCol)
{
// MatDense from GPU
if(this->dsm_funcs == nullptr)
this->dsm_funcs = new gm_DenseMatFunc_@GM_SCALAR@();
gpu_mat = ((gm_DenseMatFunc_@GM_SCALAR@*)this->dsm_funcs)->togpu(nbRow, nbCol, const_cast<double*>(data));
}
......@@ -73,6 +73,7 @@ enum FDevice
#ifdef __COMPILE_GPU__
Gpu, /* Graphic Process Unit */
#endif
GPU2
};
typedef unsigned long int faust_unsigned_int;
typedef long int faust_int;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment