On Wed, Jun 06, 2018 at 08:34:57AM +0300, Janne Blomqvist wrote: > On Wed, Jun 6, 2018 at 3:43 AM, Jerry DeLisle <jvdeli...@charter.net> wrote: > > > On 06/05/2018 06:58 AM, Rainer Orth wrote: > > > >> Hi Nicolas, > >> > >> Because they were originally intended for the gfortran test suite, but I > >>> couldn't run it there because of libpthread. I will change the numbering > >>> scheme. > >>> > >> > >> the way that libpthread dependency is currently handled seems weird to > >> me: right now it is only dragged in via -fopenmp, although libgomp isn't > >> otherwise used AFAICS. Is this really supposed to work this way? And > >> what about targets that don't have pthreads? Isn't <gthr.h> supposed to > >> abstract away from the details of the underlying threading library? > >> > > > > From my perspective, since async is a feature of the language it should > > not require any special flags, just link to pthread always. > > > > If a user does not use it, it will most likely be optimized out. > > > > This has the disadvantage that then the library will always use pthread > stuff also for single-threaded programs, where we now use the stubbed-out > dummy implementations which are faster. >
I have not looked at the source code, but do have a question. With -fopenmp, gfortran automatically adds -lpthread to the command line. Is it possible during the parsing phase to detect an async structure and on the fly add -lpthread to the loader options? I do note that if one has, say, 8 files and only one file uses async IO, then during linking of the 8 *.o files to make the final execute -lpthread must be added. How doesn't gfortran communicate that to the loader? PS: Nice work Nicolas. We'll figure out the details. -- Steve