Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Customizing Makefile for the programm using Fortran Compiler.

Konstantin_C_
Beginner
1,613 Views

Hi!

I'm trying to define the makefile for compiling the programm in Linux that uses Fortran Compiler. In the programm manual it is written that it requires FORTRAN90 compiler and MPI. I've installed Intel Parallel Sdudio 2015 and openMPI. The target template in the makefile looks like this:

# Generic target template
#=====================================================================
uknown_platform:
    $(MAKE) LD="path to FORTRAN90 Linker-loaDer" \
    LDFLAGS="appropriate flags for LD (MPI libraries)" \
    FC="path to FORTRAN90 compiler" \
    FCFLAGS="appropriate flags for FC (MPI include)" \
    EX=$(EX) BINROOT=$(BINROOT) $(TYPE)

I have Parallel Studio installed in /opt/intel. 

All the pathes are added to bashrc file

PATH=$PATH:/opt/intel/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib (the pass to the openMPI libraries)
PATH=$PATH:/opt/intel/impi_latest/bin64
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/impi_latest/lib64

When runing the makefile for stantart target from makefile 

#================== Cambridge HPC - darwin (Woodcrest)  ==============
hpc:
    $(MAKE) LD="mpif90 -o" LDFLAGS="-O3" \
    FC="mpif90 -c" FCFLAGS="-O3" \
    EX=$(EX) BINROOT=$(BINROOT) $(TYPE)

I get an error :

tata@linux-ennu:~/dl_poly_4.06/source> sudo make hpc
root's password:
make LD="mpif90 -o" LDFLAGS="-O3" \
    FC="mpif90 -c" FCFLAGS="-O3" \
    EX=DLPOLY.Z BINROOT=../execute master
make[1]: Entering directory `/home/tata/dl_poly_4.06/source'
DL_POLY_4 compilation in MPI mode

'Use mpi_module' must change to 'Use mpi' in 'comms_module.f90'

mpif90 -c -O3 kinds_f90.f90
make[1]: mpif90: Command not found
make[1]: *** [kinds_f90.o] Error 127
make[1]: Leaving directory `/home/tata/dl_poly_4.06/source'
make: *** [hpc] Error 2
tata@linux-ennu:~/dl_poly_4.06/source> cd \

Than I've tried customizing the target in Makefile:

uknown_platform:
    $(MAKE) LD="/opt/intel/impi_latest/bin64/mpif90 -o" \
    LDFLAGS="-03" \
    FC="/opt/intel/impi_latest/bin64/mpif90 -c" \
    FCFLAGS="-03" \
    EX=$(EX) BINROOT=$(BINROOT) $(TYPE)

That again leaded to the error: 

tata@linux-ennu:~/dl_poly_4.06/source> sudo make uknown_platform
root's password:
make LD="/opt/intel/impi_latest/bin64/mpif90 -o" \
    LDFLAGS="-03" \
    FC="/opt/intel/impi_latest/bin64/mpif90 -c" \
    FCFLAGS="-03" \
    EX=DLPOLY.Z BINROOT=../execute master
make[1]: Entering directory `/home/tata/dl_poly_4.06/source'
DL_POLY_4 compilation in MPI mode

'Use mpi_module' must change to 'Use mpi' in 'comms_module.f90'

/opt/intel/impi_latest/bin64/mpif90 -c -03 kinds_f90.f90
/opt/intel/impi_latest/bin64/mpif90: line 581: gfortran: command not found
/opt/intel/impi_latest/bin64/mpif90: line 760: gfortran: command not found
make[1]: *** [kinds_f90.o] Error 127
make[1]: Leaving directory `/home/tata/dl_poly_4.06/source'
make: *** [uknown_platform] Error 2
tata@linux-ennu:~/dl_poly_4.06/source>

I'm not very sure why do I get messages concerning gfortran. I haven't installed it and for configuring openMPI used ifort. Do I have any wrong parameters in the Makefile? 

Regards

 

 

 

0 Kudos
3 Replies
mecej4
Honored Contributor III
1,613 Views

Check the documentation for your version of sudo. On most systems, sudo without options does not preserve the caller's environment; in particular, $PATH is not preserved, which would cause the make to fail.

0 Kudos
Konstantin_C_
Beginner
1,613 Views

Thank you for the answer. I'll check it. At the same time I guess that the problem is in something else. Even if I write down all the pathes in the makefile (uknown_platform in makefile) the problem is still there. 

0 Kudos
TimP
Honored Contributor III
1,613 Views
Yours is not the only downside of compile under su. Still you could use the supported method of sourcing compilervars in your session.
0 Kudos
Reply