-
Notifications
You must be signed in to change notification settings - Fork 1k
also check plain '-fopenmp' for gcc #6418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@kevinushey Thank you for addressing this. At least in my case it works with gcc. Here I only apply your patch from e0bee18 and it builds and links correctly: |
|
I also ran tests, everything passes: |
|
Thanks @kevinushey and @barracuda156 for confirming. The change looks reasonable to me, let's add NEWS and ship it :) |
| fi | ||
|
|
||
| # https://github.com/Rdatatable/data.table/issues/6409 | ||
| printf "%s" "* checking if R installation supports OpenMP with \"-fopenmp\" ... " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
To avoid the slight repetition with the check above though, you could consider merging them (if it still maintains readability), maybe something like:
printf "%s" "* Checking if R installation supports OpenMP with \"-Xclang -fopenmp\" or \"-fopenmp\" ... "
if CPPFLAGS="${CPPFLAGS} -Xclang -fopenmp" PKG_LIBS="-lomp" "${R_HOME}/bin/R" CMD SHLIB test-omp.c >> config.log 2>&1 || \
CPPFLAGS="${CPPFLAGS} -fopenmp" "${R_HOME}/bin/R" CMD SHLIB test-omp.c >> config.log 2>&1; then
echo "yes"
if ${CC} --version 2>&1 | grep -q "clang"; then
PKG_CFLAGS="${PKG_CFLAGS} -Xclang -fopenmp"
PKG_LIBS="${PKG_LIBS} -lomp"
else # This probably supports a few other GCC-compatible compilers too I reckon (such as ICC and PGI perhaps), so having a generic else sounds reasonable as opposed to being checked for GCC only.
PKG_CFLAGS="${PKG_CFLAGS} -fopenmp"
fi
export PKG_CFLAGS
export PKG_LIBS
export R_OPENMP_ENABLED=1
return
else
echo "no"
fiinstead of:
printf "%s" "* checking if R installation supports OpenMP with \"-Xclang -fopenmp\" ... "
if CPPFLAGS="${CPPFLAGS} -Xclang -fopenmp" PKG_LIBS="-lomp" "${R_HOME}/bin/R" CMD SHLIB test-omp.c >> config.log 2>&1; then
echo "yes"
export PKG_CFLAGS="${PKG_CFLAGS} -Xclang -fopenmp"
export PKG_LIBS="${PKG_LIBS} -lomp"
export R_OPENMP_ENABLED=1
return
else
echo "no"
fi
printf "%s" "* checking if R installation supports OpenMP with \"-fopenmp\" ... "
if CPPFLAGS="${CPPFLAGS} -fopenmp" "${R_HOME}/bin/R" CMD SHLIB test-omp.c >> config.log 2>&1; then
echo "yes"
export PKG_CFLAGS="${PKG_CFLAGS} -fopenmp"
export R_OPENMP_ENABLED=1
return
else
echo "no"
fiThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also: Unrelated to this PR, but a minor nit while we're discussing this file - 'openmp' > 'OpenMP' here: (for consistency with the other messages)
Line 99 in 392a321
| printf "%s" "* checking if R installation supports openmp with \"-fopenmp\" flag... " |
* also check plain '-fopenmp' for gcc (closes #6409) * update NEWS * cite in NEWS --------- Co-authored-by: Michael Chirico <[email protected]>
Closes #6409
@barracuda156 is this sufficient?