Mentions légales du service

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

Integrate BSR GPU(_MOD) function structure initializations and getters into...

Integrate BSR GPU(_MOD) function structure initializations and getters into faust_gpu_mod_utils module and update to gpu_mod@e37ee8a8.
parent 608071e2
No related branches found
No related tags found
No related merge requests found
Subproject commit 748e3c939089f7b4d0d81cdd618758698762297c Subproject commit e37ee8a882a27ee94a75c2b11aac32babefe5e04
...@@ -7,7 +7,7 @@ namespace Faust { ...@@ -7,7 +7,7 @@ namespace Faust {
GPUModHandler* GPUModHandler::singleton = nullptr; GPUModHandler* GPUModHandler::singleton = nullptr;
GPUModHandler::GPUModHandler() : gm_handle(nullptr), marr_funcs_double(nullptr), marr_funcs_float(nullptr), marr_funcs_cuComplex(nullptr), marr_funcs_cuDoubleComplex(nullptr), dsm_funcs_double(nullptr), dsm_funcs_float(nullptr), dsm_funcs_cuComplex(nullptr), dsm_funcs_cuDoubleComplex(nullptr), spm_funcs_double(nullptr), spm_funcs_float(nullptr), spm_funcs_cuComplex(nullptr), spm_funcs_cuDoubleComplex(nullptr), gp_funcs_(nullptr) GPUModHandler::GPUModHandler() : gm_handle(nullptr), marr_funcs_double(nullptr), marr_funcs_float(nullptr), marr_funcs_cuComplex(nullptr), marr_funcs_cuDoubleComplex(nullptr), dsm_funcs_double(nullptr), dsm_funcs_float(nullptr), dsm_funcs_cuComplex(nullptr), dsm_funcs_cuDoubleComplex(nullptr), spm_funcs_double(nullptr), spm_funcs_float(nullptr), spm_funcs_cuComplex(nullptr), spm_funcs_cuDoubleComplex(nullptr), gp_funcs_(nullptr), bsr_funcs_double(nullptr), bsr_funcs_float(nullptr), bsr_funcs_cuComplex(nullptr), bsr_funcs_cuDoubleComplex(nullptr)
{ {
// class is only instatiatable with get_singleton (private ctor) // class is only instatiatable with get_singleton (private ctor)
} }
...@@ -151,6 +151,26 @@ namespace Faust { ...@@ -151,6 +151,26 @@ namespace Faust {
return marr_funcs_cuDoubleComplex; return marr_funcs_cuDoubleComplex;
} }
gm_BSRMatFunc_double* GPUModHandler::bsr_funcs(const double &d) const
{
return bsr_funcs_double;
}
gm_BSRMatFunc_float* GPUModHandler::bsr_funcs(const float &d) const
{
return bsr_funcs_float;
}
gm_BSRMatFunc_cuComplex* GPUModHandler::bsr_funcs(const complex<float> &c) const
{
return bsr_funcs_cuComplex;
}
gm_BSRMatFunc_cuDoubleComplex* GPUModHandler::bsr_funcs(const complex<double> &c) const
{
return bsr_funcs_cuDoubleComplex;
}
gm_GenPurposeFunc* GPUModHandler::gp_funcs() const gm_GenPurposeFunc* GPUModHandler::gp_funcs() const
{ {
return gp_funcs_; return gp_funcs_;
...@@ -178,4 +198,5 @@ namespace Faust { ...@@ -178,4 +198,5 @@ namespace Faust {
throw std::runtime_error("invalid character to convert to gm_Op"); throw std::runtime_error("invalid character to convert to gm_Op");
} }
} }
...@@ -50,6 +50,12 @@ namespace Faust ...@@ -50,6 +50,12 @@ namespace Faust
gm_SparseMatFunc_cuComplex* spm_funcs_cuComplex; gm_SparseMatFunc_cuComplex* spm_funcs_cuComplex;
gm_SparseMatFunc_cuDoubleComplex* spm_funcs_cuDoubleComplex; gm_SparseMatFunc_cuDoubleComplex* spm_funcs_cuDoubleComplex;
// BSRMat funcs for all scalar types
gm_BSRMatFunc_double* bsr_funcs_double;
gm_BSRMatFunc_float* bsr_funcs_float;
gm_BSRMatFunc_cuComplex* bsr_funcs_cuComplex;
gm_BSRMatFunc_cuDoubleComplex* bsr_funcs_cuDoubleComplex;
GPUModHandler(); GPUModHandler();
void load_gm_functions(); void load_gm_functions();
void* init_gpu_mod(const string& libpath, bool silent, void* gm_handle); void* init_gpu_mod(const string& libpath, bool silent, void* gm_handle);
...@@ -62,7 +68,7 @@ namespace Faust ...@@ -62,7 +68,7 @@ namespace Faust
void check_gpu_mod_loaded() const; void check_gpu_mod_loaded() const;
bool is_gpu_mod_loaded() const; bool is_gpu_mod_loaded() const;
// functions to access the good scalar type gpu_mod functions specifiying the type by argument value (templates are not possible here because of the C interface of the library) // functions to access the good scalar type gpu_mod functions specifiying the type by argument value (templates are not possible here because of the library C interface )
// functions for sparse matrix (typically used in MatSparse<FPP,GPU2>) // functions for sparse matrix (typically used in MatSparse<FPP,GPU2>)
gm_SparseMatFunc_double* spm_funcs(const double &d) const; gm_SparseMatFunc_double* spm_funcs(const double &d) const;
gm_SparseMatFunc_float* spm_funcs(const float &d) const; gm_SparseMatFunc_float* spm_funcs(const float &d) const;
...@@ -81,6 +87,12 @@ namespace Faust ...@@ -81,6 +87,12 @@ namespace Faust
gm_MatArrayFunc_cuComplex* marr_funcs(const complex<float> &c) const; gm_MatArrayFunc_cuComplex* marr_funcs(const complex<float> &c) const;
gm_MatArrayFunc_cuDoubleComplex* marr_funcs(const complex<double> &c) const; gm_MatArrayFunc_cuDoubleComplex* marr_funcs(const complex<double> &c) const;
// functions for sparse matrix (typically used in MatBSR<FPP,GPU2>)
gm_BSRMatFunc_double* bsr_funcs(const double &d) const;
gm_BSRMatFunc_float* bsr_funcs(const float &d) const;
gm_BSRMatFunc_cuComplex* bsr_funcs(const complex<float> &c) const;
gm_BSRMatFunc_cuDoubleComplex* bsr_funcs(const complex<double> &c) const;
gm_GenPurposeFunc* gp_funcs() const; gm_GenPurposeFunc* gp_funcs() const;
}; };
...@@ -93,12 +105,15 @@ namespace Faust ...@@ -93,12 +105,15 @@ namespace Faust
marr_funcs_##type = new gm_MatArrayFunc_##type();\ marr_funcs_##type = new gm_MatArrayFunc_##type();\
dsm_funcs_##type = new gm_DenseMatFunc_##type();\ dsm_funcs_##type = new gm_DenseMatFunc_##type();\
spm_funcs_##type = new gm_SparseMatFunc_##type();\ spm_funcs_##type = new gm_SparseMatFunc_##type();\
bsr_funcs_##type = new gm_BSRMatFunc_##type();\
load_marr_funcs_##type(gm_handle, marr_funcs_##type);\ load_marr_funcs_##type(gm_handle, marr_funcs_##type);\
load_dsm_funcs_##type(gm_handle, dsm_funcs_##type);\ load_dsm_funcs_##type(gm_handle, dsm_funcs_##type);\
load_spm_funcs_##type(gm_handle, spm_funcs_##type) load_spm_funcs_##type(gm_handle, spm_funcs_##type);\
load_bsr_funcs_##type(gm_handle, bsr_funcs_##type)
#define delete_mat_funcs(type) \ #define delete_mat_funcs(type) \
delete marr_funcs_##type; \ delete marr_funcs_##type; \
delete dsm_funcs_##type; \ delete dsm_funcs_##type; \
delete spm_funcs_##type delete spm_funcs_##type; \
delete bsr_funcs_##type
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment