forked from rdguez-mariano/fast_imas_IPOL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmex_and_omp.h
56 lines (44 loc) · 1.42 KB
/
mex_and_omp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* @file mex_and_omp.h
* @author Mariano Rodríguez
* @date 2017
* @brief Handles Mex and OpenMP. So if they're not present, you won't have any compilation error.
*/
#ifndef MEX_AND_OMP_H
#define MEX_AND_OMP_H
#ifndef _NOMEX
#include "mex.h"
#endif
#ifdef _OPENMP
#include <omp.h>
#endif
/**
* @brief If MEX is available this will call "mexEvalString(msg)". If not, it won't do anything.
* @param msg Expression to evaluate.
*/
void my_mexEvalString(char * msg);
/**
* @brief If MEX is available this will call "my_Printf(...)". If not, it won't do anything.
* @code
my_Printf("Please print: float %.2f ; int %i; string %s \n",14.82,10,'hello');
* @endcode
*/
void my_Printf(const char* format, ...);
void my_mexErrMsgTxt(char * msg);
/**
* @brief If OpenMP is available this will call "omp_get_thread_num()". If not, it will always return 1.
* @return The unique thread identification number within the current team.
*/
int my_omp_get_thread_num();
/**
* @brief If OpenMP is available this will call "omp_get_max_threads()". If not, it will always return 1.
* @return The maximum number of threads you could use.
*/
int my_omp_get_max_threads();
/**
* @brief If OpenMP is available this will call "omp_get_num_threads()". If not, it will always return 1.
* @return The number of threads used in a parallel region.
*/
int my_omp_get_num_threads();
void my_omp_set_thread_num(int num);
#endif // MEX_AND_OMP_H