ralna / GALAHAD

A library of modern Fortran modules for nonlinear optimization
https://www.galahad.rl.ac.uk
Other
119 stars 15 forks source link

compilation aborted for miqr.f90 (code 1) #3

Closed ZiyanZhu1994 closed 4 years ago

ZiyanZhu1994 commented 4 years ago

Hi,

I am trying to install the GALAHAD library with the regularised quadratic solvers and their dependencies with R2019a Matlab interface on 64-bit MAC OS/X MacBook. It returns an error as following:

Installing the double precision version compiling in /Users/ziyan/Documents/Github/cutest/galahad/src with the comand /usr/bin/make -s -f /Users/ziyan/Documents/Github/cutest/galahad/makefiles/mac64.osx.ifr rq_cutest rq_matlab Compiling miqr miqr.f90(793): error #6633: The type of the actual argument differs from the type of the dummy argument. [TIME_START] time_start, clock_start, & --------------------------------^ miqr.f90(858): error #6633: The type of the actual argument differs from the type of the dummy argument. [TIME_START] time_start, clock_start, & --------------------------^ compilation aborted for miqr.f90 (code 1) => Disabling optimization miqr.f90(793): error #6633: The type of the actual argument differs from the type of the dummy argument. [TIME_START] time_start, clock_start, & --------------------------------^ miqr.f90(858): error #6633: The type of the actual argument differs from the type of the dummy argument. [TIME_START] time_start, clock_start, & --------------------------^ compilation aborted for miqr.f90 (code 1) make[2]: [/Users/ziyan/Documents/Github/cutest/galahad/objects/mac64.osx.ifr/double/libgalahad.a(miqr.o)] Error 1 make[1]: [miqr] Error 2 make: *** [rq_cutest_double] Error 2

I would appreciate it if you could help me with it. Thanks in advance.

nimgould commented 4 years ago

Thank you, Ziyan. This was a bug. I uploaded a fix. Let me know if this doesn't sort out the issue. Nick

ZiyanZhu1994 commented 4 years ago

Thanks Nick! miqr.f90 error is fixed. However, it seems that galahad can't find the mex file. The error message is as following:

compiling in /Users/ziyan/Documents/Github/cutest/galahad/src with the comand /usr/bin/make -s -f /Users/ziyan/Documents/Github/cutest/galahad/makefiles/mac64.osx.ifr rq_cutest rq_matlab Compiling galahad_matlab /bin/sh: /bin/mex: No such file or directory make[1]: [/Users/ziyan/Documents/Github/cutest/galahad/objects/mac64.osx.ifr/double/libgalahad_matlab.a(galahad_matlab.o)] Error 127 make: [rq_matlab_double] Error 2

Could you please check this issue? Thanks in advance.

nimgould commented 4 years ago

It appears that you may not have set your MATLAB environment variable, see point 10 in the main GALAHAD README. The make cammand $(MATLAB)/bin/mex is being executed as /bin/mex

Could you check?

Thanks

Nick

ZiyanZhu1994 commented 4 years ago

Hi Nick,

Thanks a lot for your prompt reply. I noticed that I set my MATLAB environment variable before with a different name other than 'MATLAB'. Now, it is fixed.

There is another issue raised. It is related to lgomp library:

Compiling galahad_glrt Building with 'Intel Fortran Composer XE'. ld: library not found for -lgomp clang: error: linker command failed with exit code 1 (use -v to see invocation)

make[1]: [glrt] Error 255 make: [rq_matlab_double] Error 2

I'm using MacOS Mojave 10.14.6 system and Intel fortran complier for CUTEst.

Many thanks!

nimgould commented 4 years ago

Hi Ziyan

I'm afraid that this is beyond my competancy; I don't have access to an OSX system. My collaborator Dominique Orban @dpo is our Apple expert. Currently the -gomp flag is hardwired into $GALAHAD/src/matlab/makemaster, presumably because this works under linux. The ifort man page suggests that the correct flag might be -openmp but I can't be sure. Perhaps you migyht first try removing the -gomp flag entirely to see what happens; if there are then missing dependencies, it should be possible to Google them to find out how to resolve them under OSX.

Nick

dpo commented 4 years ago

Unfortunately, I don't have access to the Intel Fortran. It's only free for open source on Linux. However, I suspect Nick is right that the OpenMP flag must be adjusted. A line that is commented out in $ARCHDEFS/compiler.pc64.lnx.ifr also suggests -qopenmp.

ZiyanZhu1994 commented 4 years ago

Many thanks for your replies.

I tried to replace -lgomp by -qopenmp in GALAHAD/src/matlab/makemaster. It returns the following error message:

compiling in /Users/ziyan/Documents/Documents/Github/cutest/galahad/src with the comand /usr/bin/make -s -f /Users/ziyan/Documents/Documents/Github/cutest/galahad/makefiles/mac64.osx.ifr rq_cutest rq_matlab Compiling galahad_glrt Unknown MEX argument '-qopenmp'. make[1]: [glrt] Error 255 make: [rq_matlab_double] Error 2

I am a newbie to these operations. Do I need to edit other files to make it work?

Cheers, Ziyan

dpo commented 4 years ago

@ZiyanZhu1994 I suspect you should edit $ARCHDEFS/compiler.pc64.lnx.ifr and edit the OPENMP flag: https://github.com/ralna/ARCHDefs/blob/master/compiler.pc64.lnx.ifr#L15 (assuming you chose 64bit PC when you installed GALAHAD; otherwise edit compiler.pc.lnx.ifr). You may have to wipe the current botched installation and start over.

nimgould commented 4 years ago

Hi Dominique

I doubt that reinstallation will help, as this will presumably produce the makemaster file with the changes that Ziyan has already made. A suggestion: simply remove the -lgomp and -qopenmp commands altogether. With luck then ifort will ignore the openmp directives. Worth a try.

Ziyan, as Dominuque says, we are hampered as none of the package maintainers has access to OSX with ifort as these are both commercial products. My advice in the past has been to install a virtual linux machine under OSX, and build using gcc/gfortran on this.

Nick

ZiyanZhu1994 commented 4 years ago

Thanks for the suggestions.

I edited OPENMP flag in $ARCHDEFS/compiler.pc64.lnx.ifr (changed flag to -qopenmp, removed the -lgomp and -qopenmp ) and reinstalled GALAHAD. However, it still uses -lgomp. It seems that I need to use the other files. If it is hard to modify these settings, I would try to install a virtual linux machine.

Best, Ziyan

nimgould commented 4 years ago

Hi Ziyan

Did you try my suggestion to remove the -lgomp flag from the $GALAHAD/src/matlab/makemaster file?

Nick

ZiyanZhu1994 commented 4 years ago

Hi Nick,

I tried to comment out -lgomp from $GALAHAD/src/matlab/makemaster and complied it again. It returned the following message:

Compiling galahad_glrt Building with 'Intel Fortran Composer XE'. Undefined symbols for architecture x86_64: "dnrm2", referenced from: _galahad_norms_double_mp_twonorm in libgalahad.a(norms.o) "dpbtrf", referenced from: _galahad_sls_double_mp_slsfactorize in libgalahad.a(sls.o) "dpbtrs", referenced from: _galahad_sls_double_mp_sls_solve_onerhs in libgalahad.a(sls.o) _galahad_sls_double_mp_sls_solve_multiplerhs in libgalahad.a(sls.o) "dpotrf", referenced from: _galahad_sls_double_mp_slsfactorize in libgalahad.a(sls.o) "dpotrs", referenced from: _galahad_sls_double_mp_sls_solve_onerhs in libgalahad.a(sls.o) _galahad_sls_double_mp_sls_solve_multiplerhs in libgalahad.a(sls.o) "dpttrf", referenced from: _galahad_glrt_double_mp_glrttrts in libgalahad.a(glrt.o) _galahad_gltr_double_mp_gltrttrs in libgalahad.a(gltr.o) _galahad_gltr_double_mp_gltr_leftmosteigenvector in libgalahad.a(gltr.o) "drot", referenced from: _galahad_scu_double_mp_scudelete in libgalahad.a(scu.o) "drotg", referenced from: _galahad_scu_double_mp_scutriangular..0 in libgalahad.a(scu.o) _galahad_scu_double_mp_scuappend in libgalahad.a(scu.o) _galahad_scu_double_mp_scudelete in libgalahad.a(scu.o) _galahad_scu_double_mp_scutriangular in libgalahad.a(scu.o) _galahad_scu_double_mp_scutriangular..1 in libgalahad.a(scu.o) "dsterf", referenced from: _galahad_glrt_double_mp_glrtsolve in libgalahad.a(glrt.o) _galahad_gltr_double_mp_gltrsolve in libgalahad.a(gltr.o) "dsytrf", referenced from: _galahad_sls_double_mp_slsfactorize in libgalahad.a(sls.o) "dsytrs", referenced from: _galahad_sls_double_mp_sls_solve_onerhs in libgalahad.a(sls.o) _galahad_sls_double_mp_sls_solve_multiplerhs in libgalahad.a(sls.o) "dtbsv", referenced from: _galahad_sls_double_mp_sls_partsolve in libgalahad.a(sls.o) _galahad_sls_double_mp_sls_sparse_forwardsolve in libgalahad.a(sls.o) "dtrsv", referenced from: _galahad_sls_double_mp_sls_partsolve in libgalahad.a(sls.o) _galahad_sls_double_mp_sls_sparse_forwardsolve in libgalahad.a(sls.o) "ilaenv", referenced from: _galahad_sls_double_mp_slsanalyse in libgalahad.a(sls.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

make[1]: [glrt] Error 255 make: [rq_matlab_double] Error 2

The part of the makemaster file now is as following:

MFLAGS = CC='$(CC)' FC='$(FORTRAN)' FFLAGS='$(MFFLAGS) $(OPENMP)' \ LD='$(FORTRAN) $(MFFLAGS) $(OPENMP)' \ -g -largeArrayDims $(MATLABINC)# -lgomp # -g -largeArrayDims -compatibleArrayDims $(MATLABINC) -lgomp # -g $(MATLABINC) -lgomp

I hope I commented it correctly.

nimgould commented 4 years ago

It now seems that you need to link in the appropriate LAPACK routines. Usually this will be with the -llapack flag (if you have lapack installed) or -lgalahad_lapack -lgalahad_blas (if not). You might instead try the Intel MKL version of lapack, but you may need help from your system people to tell you the exact flags: under Linux this is

-L/opt/intel/mkl/lib/intel64 -lmkl_intel_lp64 -lmkl_gnu_thread -lmkl_core -lpthread -lm -lgalahad_dummy

Nick

ZiyanZhu1994 commented 4 years ago

Hi Nick,

Thanks a lot for your help!

We found the correct flag from https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor.

The library is installed successfully! Thanks again!

Cheers, Ziyan