tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: math/lapack and MAKE_JOBS



Am Fri, 11 Mar 2022 07:05:43 -0700
schrieb Brook Milligan <brook%nmsu.edu@localhost>: 

> > On Mar 11, 2022, at 2:40 AM, Dr. Thomas Orgis <thomas.orgis%uni-hamburg.de@localhost> wrote:
> > 
> > So there is an issue. I do think it's the same every time:
> >   
> > => Rewrite cmake Dependencies files
> > ===> Building for lapack-3.10.0  
> > Scanning dependencies of target lapack_static
> > Scanning dependencies of target lapack
> > [  0%] Building Fortran object SRC/CMakeFiles/lapack.dir/la_constants.f90.o
> > [  0%] Building Fortran object SRC/CMakeFiles/lapack_static.dir/la_constants.f90.o
> > [  0%] Building Fortran object SRC/CMakeFiles/lapack_static.dir/sbdsvdx.f.o
> > [  0%] Building Fortran object SRC/CMakeFiles/lapack_static.dir/sgbbrd.f.o
> > [  0%] Building Fortran object SRC/CMakeFiles/lapack.dir/sbdsvdx.f.o
> > [  0%] Building Fortran object SRC/CMakeFiles/lapack_static.dir/sgbcon.f.o
> > [  0%] Building Fortran object SRC/CMakeFiles/lapack_static.dir/sgbequ.f.o
> > [  0%] Building Fortran object SRC/CMakeFiles/lapack.dir/sgbbrd.f.o
> > Fatal Error: Can't delete temporary module file 'la_constants.mod0': No such file or directory
> > --- SRC/CMakeFiles/lapack.dir/la_constants.f90.o ---
> > *** [SRC/CMakeFiles/lapack.dir/la_constants.f90.o] Error code 1
> > 
> > Is your error different?  
> 
> No, that is exactly the error.

This is the error message with gcc 4.8 from CentOS. With gcc 10 I get this wording:

===> Building for lapack-3.10.0
Scanning dependencies of target lapack_static
Scanning dependencies of target lapack
[  0%] Building Fortran object SRC/CMakeFiles/lapack.dir/la_constants.f90.o
[  0%] Building Fortran object SRC/CMakeFiles/lapack.dir/sbdsvdx.f.o
[  0%] Building Fortran object SRC/CMakeFiles/lapack.dir/sgbbrd.f.o
[  0%] Building Fortran object SRC/CMakeFiles/lapack.dir/sgbcon.f.o
[  0%] Building Fortran object SRC/CMakeFiles/lapack.dir/sgbequ.f.o
[  0%] Building Fortran object SRC/CMakeFiles/lapack_static.dir/la_constants.f90.o
[  0%] Building Fortran object SRC/CMakeFiles/lapack_static.dir/sbdsvdx.f.o
[  0%] Building Fortran object SRC/CMakeFiles/lapack_static.dir/sgbbrd.f.o
[  0%] Building Fortran object SRC/CMakeFiles/lapack_static.dir/sgbcon.f.o
[  0%] Building Fortran object SRC/CMakeFiles/lapack_static.dir/sgbequ.f.o
[  0%] Building Fortran object SRC/CMakeFiles/lapack.dir/sgbrfs.f.o
[  0%] Building Fortran object SRC/CMakeFiles/lapack_static.dir/sgbrfs.f.o
f951: Fatal Error: Cannot rename module file 'la_constants.mod0' to 'la_constants.mod': No such file or directory
compilation terminated.
[  0%] Building Fortran object SRC/CMakeFiles/lapack.dir/sgbsv.f.o
[  0%] Building Fortran object SRC/CMakeFiles/lapack_static.dir/sgbsv.f.o
--- SRC/CMakeFiles/lapack.dir/la_constants.f90.o ---
*** [SRC/CMakeFiles/lapack.dir/la_constants.f90.o] Error code 1


> I suppose I should try multiple times with MAKE_JOBS_SAFE=no, but
> this looks like a parallel make problem.

Yes. I am not sure if that would even fix things, or if the issue is
really in the build rules. This looks like an internal issue for
gfortran … or … hm … maybe the same module is translated twice at the
same time and there is a race to rename it when done. That seems
plausible to me.

I wonder how you'd cause do that in CMake. I figure it should construct
rules that don't try to build the same object multiple times in
parallel.

Ah … I got an idea:

[  0%] Building Fortran object SRC/CMakeFiles/lapack.dir/la_constants.f90.o
[  0%] Building Fortran object SRC/CMakeFiles/lapack_static.dir/la_constants.f90.o

The build tries building the static and dynamic libs at the same time.
This might clash with the Fortran compiler creating the F90 .mod files
in the current directory.

Yes, that's it.

gfortran -fPIC -c -o SRC/CMakeFiles/lapack.dir/la_constants.f90.o ../SRC/la_constants.f90
gfortran -c -o SRC/CMakeFiles/lapack_static.dir/la_constants.f90.o ../SRC/la_constants.f90

will both create la_constats.mod in the current directory. The build
system is not aware of how Fortran 90 works.

I might have to drop my approach to be able to build shared and static
libs at the same time, better make two passes. Or does someone know
off-hand how to serialize the build in CMake so that it doesn't try to
build objects for the shared and static libs at the same time?

Maybe it would do the trick to explicitly call the shared/static
targets in series in our Makefile. What's the easiest way to tweak the
build that way or make it two-stage, even, with pkgsrc's CMake support?

I imagine just replacing the build target … install phase should work
as-is.


Alrighty then,

Thomas


-- 
Dr. Thomas Orgis
HPC @ Universität Hamburg


Home | Main Index | Thread Index | Old Index