Git Product home page Git Product logo

Comments (11)

koheiw avatar koheiw commented on September 23, 2024 2

from quanteda.

rsbivand avatar rsbivand commented on September 23, 2024 1

Would that be PR #2365 ?

I'll see what I can do, first clone HEAD, build, check with tbb-devel installed, then remove tbb-devel to provoke the compile error, then apply the PR and build/check to see whether the absence of tbb-devel is detected. Is that what you mean?

Is there a configure arg to turn off tbb anyway on install?

from quanteda.

kbenoit avatar kbenoit commented on September 23, 2024

And from an email from Kurt Hornik:

Related to this: your configure.ac does

# Default to no Intel TBB
TBBFLAGS=
TBBLIBS=

# If tbb.h is found, define TBB
AC_CHECK_HEADER([tbb/tbb.h],
  [TBBFLAG=-DTBB;TBBLIBS=-ltbb],
  [AC_MSG_WARN([parallel computing is disabled because tbb/tbb.h (Intel TBB) is not found])])

This is not a good idea: the code should really also run
AC_CHECK_LIB(tbb, FUNC) with a suitable FUNC before using -ltbb.

Which seems to be the problem on fedora-gcc where apparently a header is
found but the library is not available.

from quanteda.

kbenoit avatar kbenoit commented on September 23, 2024

@rsbivand Thanks for noting this. I've been trying to do some testing for this on a VM but can't get the architecture to match (my emulator is on a macOS arm base).

We'd be very grateful if you were to try a PR to fix this on your system!

from quanteda.

kbenoit avatar kbenoit commented on September 23, 2024

Would that be PR #2365 ?

No, that was just for instructions. You would need to fork the package and work with it from there and start a new PR.

I'll see what I can do, first clone HEAD, build, check with tbb-devel installed, then remove tbb-devel to provoke the compile error, then apply the PR and build/check to see whether the absence of tbb-devel is detected. Is that what you mean?

Is there a configure arg to turn off tbb anyway on install?

We don't have one at the moment but if tbb is not detected on other systems, it should just compile without it.

See also #2364 (comment).

from quanteda.

rsbivand avatar rsbivand commented on September 23, 2024

I need you to provide a minimal free-standing C++ program linking to libtbb directly. I have no idea which function can be called with no arguments, see https://github.com/rsbivand/quanteda/blob/572dbaa4a4896255ceda290bb47239104018664a/configure.ac#L36 and https://nerdland.net/2009/07/detecting-c-libraries-with-autotools/ - a function that does not fail if the library is not available is what is needed but major_version isn't it. You know TBB, so you need to find the function. In https://github.com/r-spatial/sf/blob/main/configure.ac we had to do lots of arcane things, but were working with amenable libraries.

from quanteda.

rsbivand avatar rsbivand commented on September 23, 2024

Using the example from https://link.springer.com/chapter/10.1007/978-1-4842-4398-5_1, #2368 seems to work.

from quanteda.

rsbivand avatar rsbivand commented on September 23, 2024

And the underlying reason why the header file is found even when no platform tbb devel package is installed may be that one is bundled here: RcppParallel/include/tbb/tbb.h; RcppParallel/include/tbb is actually pretty complete, but of unknown version.

from quanteda.

rsbivand avatar rsbivand commented on September 23, 2024

The header test is completely unreliable, as it seems to pick up compiler-internal traces of bits of tbb (in parts of pstl, perhaps) - I can't see leakage from RcppParallel. Hence b849a1a to drop the header test. Had tbb been properly written, it would have exposed a defined value, such as the software version, which could be read if present and printed, but which would fail otherwise.

from quanteda.

rsbivand avatar rsbivand commented on September 23, 2024

@koheiw maybe wait a little - #2368 (comment) asks about giving the location of an installed tbb if not installed in the /usr/include/tbb and /usr/lib or /usr/lib64 directories.

If tbb is installed, pkg-config --libs tbb should return -ltbb (Fedora, standard installation), and pkg-config --modversion tbb should return 2020.3 on Fedora, the relevant value on other installations. On Fedora, tbb.pc is in /usr/lib64/pkgconfig/.

If a user has a non-standard location, the tbb.pc file will be elsewhere, but this can be added to the PKG_CONFIG_PATH environment variable. In that case, it should also report the -I and -L flags needed to find the headers and library, as in https://www.intel.com/content/www/us/en/docs/onetbb/get-started-guide/2021-12/integrate-onetbb.html#INTEGRATE, section "Compile a program using pkg-config", specifically: g++ -o test test.cpp $(pkg-config --libs --cflags tbb).

If tbb is installed and PKG_CONFIG_PATH is correct, pkg-config --exists tbb exits with status 0, if not installed, with status 1. This can be used first with a warning to update PKG_CONFIG_PATH if tbb is believed to be installed, or to install it before re-installing the R package if TBB is desired.

Would you like me to adapt configure.ac to use pkg-config, or is there enough detail here for you to work with? Rtools for Windows can also use pkg-config.

from quanteda.

rsbivand avatar rsbivand commented on September 23, 2024

#2371 created.

from quanteda.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.