0

I'm trying to compile a piece of scientific code called DLPOLY (with multicore processing support). Instructions online for how to do this seem to be out of date, and the makefile only includes examples for big computing clusters and not a home computer.

Instructions are as follows:

Generic target template

unknown_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 gfortran and open-mpi installed via homebrew, along with the Xcode CLTs. I don't mind using, e.g., macports if it's easier.

edit: e.g. I tried this:

    LD="ld"
    LDFLAGS="-L/usr/local/lib"
    FC="gfortran"
    FCFLAGS="-I/usr/local/include/"

but then get this error:

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

   gfortran -I/usr/local/include/ kinds_f90.f90
   Undefined symbols for architecture x86_64:
     "_MAIN__", referenced from:
         _main in libgfortranbegin.a(fmain.o)
   ld: symbol(s) not found for architecture x86_64
   collect2: ld returned 1 exit status
   make[1]: *** [kinds_f90.o] Error 1

so I have no idea what I need to do. After further googling, I then tried:

  LD="mpif90"
  LDFLAGS="-m64"
  FC="mpif90"
  FCFLAGS="-m64"

but I got a similar error message...

Matthew
  • 1,366
  • 2
  • 15
  • 28

1 Answers1

1

Progress has been made. It starts compiling with these settings, though I don't properly understand them:

$(MAKE) FC="mpif90" LD="mpif90 -o" \
LDFLAGS="-O2 -ffast-math" \
FFLAGS="-c -O2 -ffast-math"\
EX=$(EX) BINROOT=$(BINROOT) $(TYPE)

But eventually errors-out with:

mpif90 -c -O2 -ffast-math set_bounds.f90 set_bounds.f90:36.23:

zero_plus = Nearest( 0.0_wp , 1.0_wp) 1 Error: Result of NEAREST underflows its kind at (1)

Matthew
  • 1,366
  • 2
  • 15
  • 28
  • Fixed the final error by including "-fno-range-check" in my FFFLAGS. No idea why that's necessary. – Matthew Nov 12 '12 at 01:44
  • If anyone ever finds this trying to compile DLPOLY, the only thing I've done beyond what I've typed here is to use homebrew to install gfortran and open-mpi into their default locations. I also modified "comms_module.f90" to say "Include 'mpif.h'" instead of "Use mpi" – Matthew Nov 12 '12 at 01:45
  • 1
    You should not use `include 'mpif.h'` but rather `use mpi` as instructed. The very old F77 bindings should only be used with pre-Fortran 90 compilers. `mpi_module` is a stub MPI library, provided with the `DL_POLY` source so that it can also compile as a serial executable. – Hristo Iliev Nov 12 '12 at 08:10
  • Thanks, I'll bear that in mind. I'd changed it because I was getting the "'Use mpi_module' must change to 'Use mpi' in 'comms_module.f90'" message despite having already changed that line to "Use mpi" and since I was having problems compiling I thought that might be part of the problem, because the readme file mentioned it could cause issues. Thanks again for letting me know though. – Matthew Nov 12 '12 at 09:50