However, I am wondering what the purpose of adding the -lgomp flag is. Because even when libtorch is built against system libraries, it will already have libgomp as one of its needed shared libraries:
So, adding the -lgomp linker flag only seems to have a negative side-effect that the OpenMP runtime is linked twice when it's already provided (such as in the upstream libtorch library).
I don't really remember why we need this. If you can test it for both the cpu and cuda version without this flag for the msvc period, happy to have it removed.
When building against
tch-sys
, libgomp is linked twice:The first occurrence is added through the
-lgomp
flag added throughbuild.rs
. The second occurrence is the libgomp provided by libtorch itself:However, I am wondering what the purpose of adding the
-lgomp
flag is. Because even when libtorch is built against system libraries, it will already havelibgomp
as one of its needed shared libraries:So, adding the
-lgomp
linker flag only seems to have a negative side-effect that the OpenMP runtime is linked twice when it's already provided (such as in the upstream libtorch library).