-
Notifications
You must be signed in to change notification settings - Fork 1k
Detect OpenMP support #3984
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
Detect OpenMP support #3984
Changes from all commits
4626160
7eb7e74
576c852
9ab5b33
588b709
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ | |
| ^NEWS\.0\.md$ | ||
| ^README\.md$ | ||
| ^_pkgdown\.yml$ | ||
| ^src/Makevars$ | ||
|
|
||
| ^\.RData$ | ||
| ^\.Rhistory$ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ Rplots.pdf | |
| *-Ex.R | ||
| data.table_*.tar.gz | ||
| data.table.Rcheck | ||
| src/Makevars | ||
|
|
||
| # Emacs IDE files | ||
| .emacs.desktop | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| #!/bin/sh | ||
| rm -f src/Makevars | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to cleanup the generated file with the cleanup script |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,5 +50,27 @@ fi | |
|
|
||
| version=`pkg-config --modversion zlib` | ||
| echo "zlib ${version} is available ok" | ||
| exit 0 | ||
|
|
||
| # Find R compilers | ||
| CC=`${R_HOME}/bin/R CMD config CC` | ||
| CFLAGS=`${R_HOME}/bin/R CMD config CFLAGS` | ||
| CPPFLAGS=`${R_HOME}/bin/R CMD config CPPFLAGS` | ||
|
|
||
| # Test if we have a OPENMP compatible compiler | ||
| echo "#include <omp.h>\nint main () { return omp_get_num_threads (); }" | ${CC} ${CPPFLAGS} ${PKG_CFLAGS} ${CFLAGS} ${SHLIB_OPENMP_CFLAGS} -E -xc - >/dev/null 2>&1 || R_NO_OPENMP=1; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we test a simple OpenMP program with what is in |
||
|
|
||
| # Write to Makevars | ||
| if [ $R_NO_OPENMP ]; then | ||
| echo "*** OpenMP not supported! data.table uses OpenMP to automatically" | ||
| echo "*** parallelize operations like sorting, grouping, file reading, etc." | ||
| echo "*** For details on how to install the necessary toolchains on your OS see:" | ||
| echo "*** https://github.com/Rdatatable/data.table/wiki/Installation" | ||
| echo "*** Continuing installation without OpenMP support..." | ||
| sed -e "s|@openmp_cflags@||" src/Makevars.in > src/Makevars | ||
|
MichaelChirico marked this conversation as resolved.
|
||
| else | ||
| echo "OpenMP supported" | ||
| sed -e "s|@openmp_cflags@|\$(SHLIB_OPENMP_CFLAGS)|" src/Makevars.in > src/Makevars | ||
|
Comment on lines
+69
to
+72
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then we replace the placeholder |
||
| fi | ||
|
|
||
|
|
||
| exit 0 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,6 @@ | ||
|
|
||
| PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS) | ||
| PKG_LIBS = $(SHLIB_OPENMP_CFLAGS) -lz | ||
| PKG_CFLAGS = @openmp_cflags@ | ||
| PKG_LIBS = @openmp_cflags@ -lz | ||
|
|
||
| all: $(SHLIB) | ||
| mv $(SHLIB) datatable$(SHLIB_EXT) | ||
| if [ "$(OS)" != "Windows_NT" ] && [ `uname -s` = 'Darwin' ]; then install_name_tool -id datatable$(SHLIB_EXT) datatable$(SHLIB_EXT); fi | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| PKG_LIBS = $(SHLIB_OPENMP_CFLAGS) -lz | ||
|
|
||
| all: $(SHLIB) | ||
| mv $(SHLIB) datatable$(SHLIB_EXT) | ||
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.
We need to ignore the generated Makevars in both git and the built package, we generate it from
src/Makevars.inin theconfigurescript.