Skip to content

add system TBB autodetection on Unix #178

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

Merged
merged 1 commit into from
Jan 31, 2023
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
8 changes: 7 additions & 1 deletion src/Makevars.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ ifdef TBB_ROOT

endif

# If TBB_LIB is defined by TBB_INC is not, make a guess.
# If TBB_LIB is not defined, try to use autodetection
ifndef TBB_LIB
TBB_LIB = @TBB_LIB_AUTO@
TBB_INC = @TBB_INC_AUTO@
endif

# If TBB_LIB is defined but TBB_INC is not, make a guess.
ifdef TBB_LIB
ifndef TBB_INC
TBB_INC = $(TBB_LIB)/../include
Expand Down
20 changes: 20 additions & 0 deletions tools/config/configure.R
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,23 @@ if (Sys.info()[["sysname"]] == "SunOS") {
}
}

# tbb autodetection on Unix
define(TBB_LIB_AUTO = "", TBB_INC_AUTO = "")
if (.Platform$OS.type == "unix") {
tbbLib <- Sys.glob(c(
"/usr/*/libtbb.so",
Copy link
Contributor

Choose a reason for hiding this comment

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

If we wanted to support common macOS configurations (on arm64 machines) we could check /opt/homebrew/lib and /opt/homebrew/include/tbb.

"/usr/*/*/libtbb.so",
"/usr/*/*/*/libtbb.so"
))
tbbInc <- Sys.glob(c(
"/usr/include/tbb.h",
"/usr/include/*/tbb.h"
))
if (length(tbbLib) && length(tbbInc)) {
define(
TBB_LIB_AUTO = dirname(tbbLib[1]),
TBB_INC_AUTO = dirname(tbbInc[1])
)
}
}