From 924c74eb24997665938595eb4b05e4545466dddb Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Tue, 10 Feb 2015 13:48:53 +0100 Subject: [PATCH] Addded missing openmp file --- src/openmp.hpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/openmp.hpp diff --git a/src/openmp.hpp b/src/openmp.hpp new file mode 100644 index 0000000..7ef2c76 --- /dev/null +++ b/src/openmp.hpp @@ -0,0 +1,44 @@ +#ifndef __CTOOL_OPENMP_HPP +#define __CTOOL_OPENMP_HPP + +#ifdef _OPENMP +#include +#endif + +namespace CosmoTool { + + static int smp_get_max_threads() { +#ifdef _OPENMP + return omp_get_max_threads(); +#else + return 1; +#endif + } + + static int smp_get_thread_id() { +#ifdef _OPENMP + return omp_get_thread_num(); +#else + return 0; +#endif + } + + static int smp_get_num_threads() { +#ifdef _OPENMP + return omp_get_num_threads(); +#else + return 1; +#endif + + } + + static void smp_set_nested(bool n) { +#ifdef _OPENMP + omp_set_nested(n ? 1 : 0); +#endif + } + + +}; + +#endif