Mentions légales du service

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

GPU code compatibility for read_mat_file in C++ core and pyfaust wrapper pyx code.

parent 0d9bfd76
No related branches found
No related tags found
No related merge requests found
......@@ -127,6 +127,8 @@ namespace Faust
void save_mat_file(const char* filepath) const;
TransformHelper<FPP,GPU2> read_from_mat_file(const char* filepath);
static int get_mat_file_type(const char* filepath);
FPP get_item(faust_unsigned_int i, faust_unsigned_int j);
virtual ~TransformHelper() {};
static TransformHelper<FPP,GPU2>* hadamardFaust(unsigned int n, const bool norma=true);
......
......@@ -381,27 +381,6 @@ bool FaustCoreCpp<FPP,DEV>::save_mat_file(const char* filepath) const
}
}
template<typename FPP, FDevice DEV>
FaustCoreCpp<FPP,DEV>* FaustCoreCpp<FPP,DEV>::read_from_mat_file(const char* filepath)
{
FaustCoreCpp<FPP, DEV>* core = nullptr;
try
{
auto th = new Faust::TransformHelper<FPP, Cpu>();
th->read_from_mat_file(filepath);
core = new FaustCoreCpp<FPP,DEV>(th);
}
catch(exception& e)
{
if(core != nullptr)
{
delete core;
core = nullptr;
}
}
return core;
}
template<typename FPP, FDevice DEV>
int FaustCoreCpp<FPP,DEV>::get_mat_file_type(const char* filepath)
{
......
......@@ -116,3 +116,24 @@ FaustCoreCpp<Real<@TYPE@>,Cpu>* FaustCoreCpp2<@TYPE@, Real<@TYPE@>, Cpu>::real(F
{
return core->real();
}
template<>
FaustCoreCpp<@TYPE@,Cpu>* FaustCoreCpp<@TYPE@,Cpu>::read_from_mat_file(const char* filepath)
{
FaustCoreCpp<@TYPE@, Cpu>* core = nullptr;
try
{
auto th = new Faust::TransformHelper<@TYPE@, Cpu>();
th->read_from_mat_file(filepath);
core = new FaustCoreCpp<@TYPE@,Cpu>(th);
}
catch(exception& e)
{
if(core != nullptr)
{
delete core;
core = nullptr;
}
}
return core;
}
......@@ -97,3 +97,10 @@ FaustCoreCpp<Real<@TYPE@>,GPU2>* FaustCoreCpp2<@TYPE@,Real<@TYPE@>,GPU2>::real(F
{
return core->real();
}
template<>
FaustCoreCpp<@TYPE@,GPU2>* FaustCoreCpp<@TYPE@,GPU2>::read_from_mat_file(const char* filepath)
{
throw std::runtime_error("A .mat file is always read from CPU code not GPU's.");
return nullptr;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment