Skip to content
Snippets Groups Projects
Commit 40f0bf60 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

Cxx11: added version numbers to blobs/sinos operations

parent 09c9afa3
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,25 @@ mxArray * process_data(const mxArray * const blobs_cells, const mxArray * const ...@@ -33,6 +33,25 @@ mxArray * process_data(const mxArray * const blobs_cells, const mxArray * const
void mexFunction( int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[] ) void mexFunction( int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[] )
{ {
size_t num_threads = std::thread::hardware_concurrency();
bool use_avx = false;
if (nrhs == 1) {
std::string option = dct::DctMatlabData::get_string(prhs[0]);
if (option == "version") {
plhs[0] = mxCreateDoubleScalar(dct::VERSION_MAJOR);
plhs[1] = mxCreateDoubleScalar(dct::VERSION_MINOR);
} else if (option == "info") {
mexPrintf("[gtCxx6DBlobsToMultipleSinos] Defaults - num_threads: %lu, use_avx: %s\n", num_threads, use_avx ? "true" : "false");
} else if (option == "help") {
mexPrintf("sinos = gtCxx6DBlobsToMultipleSinos(sinos_sizes, blobs, coeff_struct [, 'threads', num_threads, 'use_avx', true|false])\n");
} else {
mexErrMsgIdAndTxt(error_id,
"Options allowed: 'version', 'info', and 'help'");
}
return;
}
const size_t base_args = 3; const size_t base_args = 3;
if (nrhs < base_args) { if (nrhs < base_args) {
mexErrMsgIdAndTxt(error_id, mexErrMsgIdAndTxt(error_id,
...@@ -63,9 +82,6 @@ void mexFunction( int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[] ) ...@@ -63,9 +82,6 @@ void mexFunction( int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[] )
return; return;
} }
size_t num_threads = std::thread::hardware_concurrency();
bool use_avx = false;
if (nrhs > base_args) { if (nrhs > base_args) {
if ((nrhs - base_args) % 2) { if ((nrhs - base_args) % 2) {
mexErrMsgIdAndTxt(error_id, mexErrMsgIdAndTxt(error_id,
......
...@@ -31,6 +31,25 @@ void process_data(mxArray * const out_blobs, const mxArray * const sinos_cells, ...@@ -31,6 +31,25 @@ void process_data(mxArray * const out_blobs, const mxArray * const sinos_cells,
void mexFunction( int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[] ) void mexFunction( int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[] )
{ {
size_t num_threads = std::thread::hardware_concurrency();
bool use_avx = false;
if (nrhs == 1) {
std::string option = dct::DctMatlabData::get_string(prhs[0]);
if (option == "version") {
plhs[0] = mxCreateDoubleScalar(dct::VERSION_MAJOR);
plhs[1] = mxCreateDoubleScalar(dct::VERSION_MINOR);
} else if (option == "info") {
mexPrintf("[gtCxx6DMultipleSinosToBlobs] Defaults - num_threads: %lu, use_avx: %s\n", num_threads, use_avx ? "true" : "false");
} else if (option == "help") {
mexPrintf("blobs = gtCxx6DMultipleSinosToBlobs(blobs, sinos, coeff_struct [, 'threads', num_threads, 'use_avx', true|false])\n");
} else {
mexErrMsgIdAndTxt(error_id,
"Options allowed: 'version', 'info', and 'help'");
}
return;
}
const size_t base_args = 3; const size_t base_args = 3;
if (nrhs < base_args) { if (nrhs < base_args) {
mexErrMsgIdAndTxt(error_id, mexErrMsgIdAndTxt(error_id,
...@@ -69,9 +88,6 @@ void mexFunction( int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[] ) ...@@ -69,9 +88,6 @@ void mexFunction( int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[] )
return; return;
} }
size_t num_threads = std::thread::hardware_concurrency();
bool use_avx = false;
if (nrhs > base_args) { if (nrhs > base_args) {
if ((nrhs - base_args) % 2) { if ((nrhs - base_args) % 2) {
mexErrMsgIdAndTxt(error_id, mexErrMsgIdAndTxt(error_id,
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
namespace dct { namespace dct {
static const size_t VERSION_MAJOR = 0;
static const size_t VERSION_MINOR = 0;
// This class is intentionally not memory-safe!! Be careful with it.. // This class is intentionally not memory-safe!! Be careful with it..
template<typename Type, class Alloc = VectorAllocator<Type> > template<typename Type, class Alloc = VectorAllocator<Type> >
class DctData : public VectorOperations<Type> { class DctData : public VectorOperations<Type> {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment