Skip to content

building r packages, can we enable parallel c/c++ compilation? #953

@jiridanek

Description

@jiridanek

I'm seeing

g++ -std=gnu++17 -shared -L/usr/lib64/R/lib -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -o httpuv.so RcppExports.o callback.o callbackqueue.o filedatasource-unix.o filedatasource-win.o fs.o gzipdatasource.o http.o httprequest.o httpresponse.o httpuv.o md5.o mime.o socket.o staticpath.o thread.o timegm.o utils.o uvutil.o webapplication.o websockets-base.o websockets-hixie76.o websockets-hybi03.o websockets-ietf.o websockets.o winutils.o ./libuv/.libs/libuv.a ./http-parser/http_parser.o ./sha1/sha1.o ./base64/base64.o -pthread -L/usr/lib64/R/lib -lR
lto-wrapper: warning: using serial compilation of 9 LTRANS jobs

From what I recall, if we had some options set, this would be able to run in parallel. In general, serial compilation of c/c++ can be a lot slower than -j2.

Google Gemini says

MAKEFLAGS Environment Variable:
If your build system uses make, set the MAKEFLAGS environment variable to specify the number of parallel jobs.
Example:

export MAKEFLAGS="-j$(nproc)"

(where $(nproc) gets the number of CPU cores).

It further warns about running out of memory trying to run too many linktime optimization jobs in paralel. We shoud try -j2 or -j3, and not try to determine number automatically, I think.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions