ralna / CUTEst

The Constrained and Unconstrained Testing Environment with safe threads (CUTEst) for optimization software
Other
88 stars 19 forks source link

Parallel compilation #38

Open chrhansk opened 11 months ago

chrhansk commented 11 months ago

I noticed after some debugging that the standard command

$ARCHDEFS/install_optrove

uses make internally to compile libcutest.a. Unfortunately, the compilation rule uses commands modifying the file libcutest.a in place. The compilation therefore breaks whenever multiple threads are used (i.e., using make -j<n> or by having MAKEFLAGS="-j<n>" set in the environment).

Since the behavior is unpredictable and errors of the form

/usr/bin/ar: /cutest/cutest/objects/pc64.lnx.gfo/double/libcutest.a: error reading cutest.o: file truncated 
/usr/bin/ar: /cutest/cutest/objects/pc64.lnx.gfo/double/libcutest.a: malformed archive

are not caught, the compilation can silently fail. I think it would be a good idea to put a warning in the wiki to.

nimgould commented 11 months ago

Thanks for your comments. As I am sure you aware, parallel compilation of libraries of modern Fortran modules is dangerous, since the module structure requires a strict ordering. We do not recommend the -j option for make for any fortran-based system. We are aware of the issue, and we are currently moving the build system away from make to meson, which is aware of such ordering issues. Nick

Sent from Outlook for Androidhttps://aka.ms/AAb9ysg


From: Christoph Hansknecht @.> Sent: Sunday, October 22, 2023 7:42:30 PM To: ralna/CUTEst @.> Cc: Subscribed @.***> Subject: [ralna/CUTEst] Parllel compilation (Issue #38)

I noticed after some debugging that the standard command

$ARCHDEFS/install_optrove

uses make internally to compile libcutest.a. Unfortunately, the compilation rulehttps://github.com/ralna/CUTEst/blob/master/src/tools/makemaster#L191-L276 uses commands modifying the file libcutest.a in place. The compilation therefore breaks whenever multiple threads are used (i.e., using make -j or by having MAKEFLAGS="-j" set in the environment).

Since the behavior is unpredictable and errors of the form

/usr/bin/ar: /cutest/cutest/objects/pc64.lnx.gfo/double/libcutest.a: error reading cutest.o: file truncated /usr/bin/ar: /cutest/cutest/objects/pc64.lnx.gfo/double/libcutest.a: malformed archive

are not caught, the compilation can silently fail. I think it would be a good idea to put a warning in the wiki to.

— Reply to this email directly, view it on GitHubhttps://github.com/ralna/CUTEst/issues/38, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACW4A6VMJ2PQWW3G2EAIXCTYAVSJNAVCNFSM6AAAAAA6LCSJGOVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE2TMMBRGAZDCNI. You are receiving this because you are subscribed to this thread.Message ID: @.***>

amontoison commented 3 months ago

@chrhansk I just merged the Meson build system (release 2.1.0).

meson setup builddir
meson compile -C builddir
meson install -C builddir

It compiles libcutest_single.a and libcutest_double.a in less than 30 seconds.