I am submitting an R package to CRAN with C++ code. I've read and re-read Section 1.2.1.1 "OpenMP support" in the manual: https://cran.r-project.org/doc/manuals/r-devel/R-exts.html#OpenMP-support
Based on this, I use conditionals for any OpenMP calls as follows:
#ifdef _OPENMP
#include <omp.h>
#endif
#ifdef _OPENMP
omp_set_num_threads(n_cores);
#endif
#ifdef _OPENMP
#pragma omp parallel for schedule(dynamic)
#endif
#ifdef _OPENMP
#pragma omp critical
#endif
Unfortunately, CRAN still flags my package for violating OpenMP issues.
I'm stumped. Why would this be? Surely the conditionals resolve this issue, no? Have I misunderstood the manual?
Any help appreciated. Thank you.