-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from mrc-ide/mrc-5881
Import OpenMP support detection from dust1
- Loading branch information
Showing
11 changed files
with
464 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifdef _OPENMP | ||
#include <omp.h> | ||
#endif | ||
|
||
[[cpp11::register]] | ||
int openmp_get_thread_id() { | ||
#ifdef _OPENMP | ||
return omp_get_thread_num(); | ||
#else | ||
return -1; | ||
#endif | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifdef _OPENMP | ||
#include <omp.h> | ||
#endif | ||
|
||
#include <cpp11/list.hpp> | ||
#include <cpp11/list_of.hpp> | ||
|
||
[[cpp11::register]] | ||
cpp11::writable::list cpp_openmp_info() { | ||
#ifdef _OPENMP | ||
const int num_procs = omp_get_num_procs(); | ||
const int max_threads = omp_get_max_threads(); | ||
const int thread_limit = omp_get_thread_limit(); | ||
static int openmp_version = _OPENMP; | ||
static bool has_openmp = true; | ||
#else | ||
static int num_procs = NA_INTEGER; | ||
static int max_threads = NA_INTEGER; | ||
static int thread_limit = NA_INTEGER; | ||
static int openmp_version = NA_INTEGER; | ||
static bool has_openmp = false; | ||
#endif | ||
using namespace cpp11::literals; | ||
return cpp11::writable::list({"num_procs"_nm = num_procs, | ||
"max_threads"_nm = max_threads, | ||
"thread_limit"_nm = thread_limit, | ||
"openmp_version"_nm = openmp_version, | ||
"has_openmp"_nm = has_openmp}); | ||
} |
Oops, something went wrong.