Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
^NEWS\.0\.md$
^README\.md$
^_pkgdown\.yml$
^src/Makevars$
Copy link
Copy Markdown
Contributor Author

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.in in the configure script.


^\.RData$
^\.Rhistory$
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Rplots.pdf
*-Ex.R
data.table_*.tar.gz
data.table.Rcheck
src/Makevars

# Emacs IDE files
.emacs.desktop
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

1. `DT[, {...; .(A,B)}]` (i.e. when `.()` is the final item of a multi-statement `{...}`) now auto-names the columns `A` and `B` (just like `DT[, .(A,B)]`) rather than `V1` and `V2`, [#2478](https://github.com/Rdatatable/data.table/issues/2478) [#609](https://github.com/Rdatatable/data.table/issues/609). Similarly, `DT[, if (.N>1) .(B), by=A]` now auto-names the column `B` rather than `V1`. Explicit names are unaffected; e.g. `DT[, {... y= ...; .(A=C+y)}, by=...]` named the column `A` before, and still does. Thanks also to @renkun-ken for his go-first strong testing which caught an issue not caught by the test suite or by revdep testing, related to NULL being the last item, [#4061](https://github.com/Rdatatable/data.table/issues/4061).

2. Compiler support for OpenMP is now detected during installation, which allows data.table to compile even if the users' toolchain differs from CRANs, as is common on macOS, [#2161](https://github.com/Rdatatable/data.table/issues/2161). Thanks @jimhester for the PR.

## BUG FIXES

## NOTES
Expand Down
2 changes: 2 additions & 0 deletions cleanup
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
rm -f src/Makevars
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to cleanup the generated file with the cleanup script

24 changes: 23 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we test a simple OpenMP program with what is in SHLIB_OPENMP_CFLAGS to verify that our current compiler supports OpenMP.


# 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
Comment thread
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
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we replace the placeholder @openmp_cflags@ with either nothing if the compiler doesn't support it or SHLIB_OPENMP_CFLAGS if it does.

fi


exit 0
7 changes: 2 additions & 5 deletions src/Makevars → src/Makevars.in
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


5 changes: 5 additions & 0 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configure will only run on non-Windows, which means that src/Makevars will not be generated there, so we need to supply Makevars.win for windows. But we don't really need to check if OpenMP is supported, because the Rtools compilers all support it.

PKG_LIBS = $(SHLIB_OPENMP_CFLAGS) -lz

all: $(SHLIB)
mv $(SHLIB) datatable$(SHLIB_EXT)