NWChem 6.6: MA fatal error: MA sizeof: invalid datatype (macOS)


Clicked A Few Times
Dear developers,

I am trying to compile NWChem on macOS with all the patches using Clang 7.3.0 + Gfortran 6.1 and have the following error on execution of a simple example script:

MA fatal error: MA_sizeof: invalid datatype: 4333622002677


Variables are set to the following values
USE_MPI=y
MPI_LOC=/path/to/mpich-3.2
USE_PYTHONCONFIG=y
PYTHONVERSION=2.7
BLASOPT=-L/path/to/openblas-0.2.18/lib -lopenblas
BLAS_LIB=-L/path/to/openblas-0.2.18/lib -lopenblas
LAPACK_LIB=-L/path/to/openblas-0.2.18/lib -lopenblas
USE_SCALAPACK=y
SCALAPACK=-L/path/to/netlib-scalapack-2.0.2/lib -lscalapack
NWCHEM_MODULES=all
NWCHEM_LONG_PATHS=Y
USE_64TO32=y
BLAS_SIZE=4
LAPACK_SIZE=4
SCALAPACK_SIZE=4
CFLAGS_FORGA=-DMPICH_NO_ATTR_TYPE_TAGS
NWCHEM_TARGET=MACX64


The in 'src' essentially run
make nwchem_config
make 64_to_32
make


It looks like it has to do with GA lib (one of many warnings)
../ga-5-4/global/src/ga_solve_seq.c:547:64: warning: incompatible pointer types passing 'Integer *' (aka 'long *') to parameter of type 'int *' [-Wincompatible-pointer-types]
    LAPACK_DGETRF(&blas_dimA1, &blas_dimA2, adra, &blas_dimA1, adri, &info);

and
../ga-5-4/global/src/peigstubs.c:15:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
extern gai_diag_std_(Integer*,Integer*,DoublePrecision*);



The output of head -25 $NWCHEM_TOP/src/tools/build/config.log is (with a minor cleanup)
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by Global Arrays (GA) configure 5.4, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ../ga-5-4/configure --prefix=/private/var/folders/5k/sqpp24tx3ylds4fgm13pfht00000gn/T/davydden/spack-stage/spack-stage-v3fpyQ/nwchem-6.6/src/tools/install --with-tcgmsg --with-mpi=-I/path/to/openmpi-2.0.0-6uy66j3mu3rsjoiauplx556zsr7yzaon/include -I/path/to/openmpi-2.0.0-6uy66j3mu3rsjoiauplx556zsr7yzaon/lib -L/path/to/hwloc-1.11.3-jtkwa4li2oxkedg6j4fc2p2in2tlf3hb/lib -L/path/to/openmpi-2.0.0-6uy66j3mu3rsjoiauplx556zsr7yzaon/lib -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi /path/to/openmpi-2.0.0-6uy66j3mu3rsjoiauplx556zsr7yzaon --enable-peigs --enable-underscoring --disable-mpi-tests --with-scalapack=-L/path/to/netlib-scalapack-2.0.2-67ivdjnztrc6tpfyjyukcnciomytuwjv/lib -lscalapack --with-lapack=-L/path/to/openblas-0.2.18-uns5kq5bhcrx6w2ol34w3mfvjog7wnpw/lib -lopenblas --with-blas4=-L/path/to/openblas-0.2.18-uns5kq5bhcrx6w2ol34w3mfvjog7wnpw/lib -lopenblas --with-mpi-ts CC=clang CXX=clang++ F77=gfortran CFLAGS=-DMPICH_NO_ATTR_TYPE_TAGS ARMCI_DEFAULT_SHMMAX_UBOUND=131072

## --------- ##
## Platform. ##


p.s. A similar build (without CFLAGS_FORGA and with LINUX64) on Ubuntu 16.04 and gcc5.2 seems to work fine.

Forum Vet
Could you please post the output of the following commands

gcc -v
gfortran -v
cd $NWCHEM_TOP/src/inp
touch inp.F
make

Forum Vet
Could you please upload the following files to a public website

$NWCHEM_TOP/src/tools/build/config.log
$NWCHEM_TOP/src/tools/build/armci/config.log
$NWCHEM_TOP/src/tools/build/comex/config.log

Clicked A Few Times
Hi Edoapra,

$ gfortran -v
Reading specs from /Users/davydden/spack/opt/spack/darwin-elcapitan-x86_64/clang-7.3.0-apple/gcc-6.1.0-yjkpe3clg23uuacydkq35kdd5xt3v34u/lib64/gcc/x86_64-apple-darwin15.6.0/6.1.0/specs
COLLECT_GCC=/Users/davydden/spack/opt/spack/darwin-elcapitan-x86_64/clang-7.3.0-apple/gcc-6.1.0-yjkpe3clg23uuacydkq35kdd5xt3v34u/bin/gfortran
COLLECT_LTO_WRAPPER=/Users/davydden/spack/opt/spack/darwin-elcapitan-x86_64/clang-7.3.0-apple/gcc-6.1.0-yjkpe3clg23uuacydkq35kdd5xt3v34u/libexec/gcc/x86_64-apple-darwin15.6.0/6.1.0/lto-wrapper
Target: x86_64-apple-darwin15.6.0
Configured with: /Users/davydden/spack/var/spack/stage/gcc-6.1.0-yjkpe3clg23uuacydkq35kdd5xt3v34u/gcc-6.1.0/configure --prefix=/Users/davydden/spack/opt/spack/darwin-elcapitan-x86_64/clang-7.3.0-apple/gcc-6.1.0-yjkpe3clg23uuacydkq35kdd5xt3v34u --libdir=/Users/davydden/spack/opt/spack/darwin-elcapitan-x86_64/clang-7.3.0-apple/gcc-6.1.0-yjkpe3clg23uuacydkq35kdd5xt3v34u/lib64 --disable-multilib --enable-languages=fortran,c,java,objc,c++ --with-mpc=/Users/davydden/spack/opt/spack/darwin-elcapitan-x86_64/clang-7.3.0-apple/mpc-1.0.3-efuklfohais7xtgiitw5fckbrmok6qle --with-mpfr=/Users/davydden/spack/opt/spack/darwin-elcapitan-x86_64/clang-7.3.0-apple/mpfr-3.1.4-ruvsg2nfdda3c5dx74ydghw2li6f6h2w --with-gmp=/Users/davydden/spack/opt/spack/darwin-elcapitan-x86_64/clang-7.3.0-apple/gmp-6.1.1-vg3hqprv7ngioz3zy7essfa3chmazmwv --enable-lto --with-quad --with-isl=/Users/davydden/spack/opt/spack/darwin-elcapitan-x86_64/clang-7.3.0-apple/isl-0.14-4ddiuxsw2slqhh7amhtfhc5lyy3cq5io --with-build-config=bootstrap-debug
Thread model: posix
gcc version 6.1.0 (GCC)


I don't use gcc, should be irrelevant. Also CC and FC environment variables are set to point to Clang and gfortran. But since you asked, the `gcc` points to the system's gcc

 gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1


$ clang -v
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin


Here are the links to logs:

https://dl.dropboxusercontent.com/u/52046612/armci_config.log.zip
https://dl.dropboxusercontent.com/u/52046612/comex_config.log.zip
https://dl.dropboxusercontent.com/u/52046612/config.log.zip

Do not mind unusual paths in logs, it's because NWChem is compiled within a package manager Spack (https://github.com/LLNL/spack) -- a flexible package manager developed with High-Perfomance-Computing in mind.

Clicked A Few Times
testing http://nwchemgit.github.io/download.php?f=Gcc6_macs_optfix.patch.gz...

update:

the problem persist.

Forum Vet

Sure,
That patch is addressing a separate gcc 6 issue

Could you please post the output of

cd $NWCHEM_TOP/src/inp
touch inp.F
make

Clicked A Few Times
sure:

/Users/davydden/spack/var/spack/stage/nwchem-6.6-wyq6isbd6seuqiuluj6ztf3mzqsdpycv/nwchem-6.6/bin/MACX64/depend.x  -I/Users/davydden/spack/var/spack/stage/nwchem-6.6-wyq6isbd6seuqiuluj6ztf3mzqsdpycv/nwchem-6.6/src/tools/install/include > dependencies
/Users/davydden/spack/lib/spack/env/clang/gfortran  -c   -I.  -I/Users/davydden/spack/var/spack/stage/nwchem-6.6-wyq6isbd6seuqiuluj6ztf3mzqsdpycv/nwchem-6.6/src/include -I/Users/davydden/spack/var/spack/stage/nwchem-6.6-wyq6isbd6seuqiuluj6ztf3mzqsdpycv/nwchem-6.6/src/tools/install/include -DMACX -DEXT_INT -DSCALAPACK -DPARALLEL_DIAG   inp.F
inp.F:27:19:

       data xback /'\\'/         ! Backslash ... note backslash for cpp
                   1
Warning: Initialization string at (1) was truncated to fit the variable (1/2)
Got lock on /Users/davydden/spack/var/spack/stage/nwchem-6.6-wyq6isbd6seuqiuluj6ztf3mzqsdpycv/nwchem-6.6/lib/MACX64/libnwcutil.lock
ar r /Users/davydden/spack/var/spack/stage/nwchem-6.6-wyq6isbd6seuqiuluj6ztf3mzqsdpycv/nwchem-6.6/lib/MACX64/libnwcutil.a inp.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: /Users/davydden/spack/var/spack/stage/nwchem-6.6-wyq6isbd6seuqiuluj6ztf3mzqsdpycv/nwchem-6.6/lib/MACX64/libnwcutil.a(util_md_c.o) has no symbols
ranlib /Users/davydden/spack/var/spack/stage/nwchem-6.6-wyq6isbd6seuqiuluj6ztf3mzqsdpycv/nwchem-6.6/lib/MACX64/libnwcutil.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: /Users/davydden/spack/var/spack/stage/nwchem-6.6-wyq6isbd6seuqiuluj6ztf3mzqsdpycv/nwchem-6.6/lib/MACX64/libnwcutil.a(util_md_c.o) has no symbols

Forum Vet
missing -fdefault-integer-8 option
Denis
Something goes wrong in the makefile structure since the Fortran compiler option that would fix your problem is missing (-fdefault-integer-8 option).

Could you please try the following:
First try:

cd $NWCHEM_TOP/src/inp
touch inp.F
make FC=gfortran

If this fails, please try this second alternative set of commands

cd $NWCHEM_TOP/src/inp
touch inp.F
make _FC=gfortran

Notice the underscore "_" sign before FC

Clicked A Few Times
Quote:Edoapra Aug 24th 5:13 pm

Something goes wrong in the makefile structure since the Fortran compiler option that would fix your problem is missing (-fdefault-integer-8 option).


Could that be that somewhere in makefiles it is assumed that C/C++ and Fortran compilers can't be mixed from different families (Clang + Gfortran)? Although i would assume the same situation happens with NAG fortran compilers.

When I compile NWchem, the environment variables CC, CXX, F77, FC are all set and point to Clang and gfortran compilers (wrappers in Spack).

So

Quote:Edoapra Aug 24th 5:13 pm

make FC=gfortran


should not make a difference. I will try setting `_FC=/point/to/gfortran`...

Forum Vet
Quote:Den59 Aug 24th 10:22 am
Quote:Edoapra Aug 24th 5:13 pm

Something goes wrong in the makefile structure since the Fortran compiler option that would fix your problem is missing (-fdefault-integer-8 option).


Could that be that somewhere in makefiles it is assumed that C/C++ and Fortran compilers can't be mixed from different families (Clang + Gfortran)? Although i would assume the same situation happens with NAG fortran compilers.

When I compile NWchem, the environment variables CC, CXX, F77, FC are all set and point to Clang and gfortran compilers (wrappers in Spack).

So

Quote:Edoapra Aug 24th 5:13 pm

make FC=gfortran


should not make a difference. I will try setting `_FC=/point/to/gfortran`...


That is not going to work either (e.g. using make _FC=/longhorriblepath/gfortran)
The root cause of the problem is the makefile gets lost when you give the full path to either FC or _FC
The patch below should address this issue
How to apply

cd $NWCHEM_TOP
curl http://nwchemgit.github.io/images/Notdir_fc.patch.gz > Notdir_fc.patch.gz
gzip -d Notdir_fc.patch.gz
patch -p0 < Notdir_fc.patch
How to test

cd $NWCHEM_TOP/src/inp
touch inp.F
make
If this triggers the correct -fdefault-integer-8 behavior, then you will need to recompile all the NWChem bits using the command

make

Clicked A Few Times
Quote:Edoapra Aug 24th 7:11 pm

The root cause of the problem is the makefile gets lost when you give the full path to either FC or _FC


Oh, i see. I will try the patch and let you know...

Does the patch apply to all compilers (Intel, gcc, nag, etc), both FC and CC? If not, then it would probably be a more robust solution for me to set FC and CC to point to basename (gfortran) instead of the full path (long/path/to/gfortran) as directories are in PATH anyway.

Forum Vet
Thanks for the tip on FC/CC, etc ...
I have uploaded a new version of the patch (if you use this new version, please remove the older patch, first)

Yes, the recommended way to compile NWChem has always been to compile with the simple command
make FC=gfortran
i.e. without providing the full path

Clicked A Few Times
Quote:Edoapra Aug 24th 8:00 pm

I have uploaded a new version of the patch (if you use this new version, please remove the older patch, first)

Yes, the recommended way to compile NWChem has always been to compile with the simple command
make FC=gfortran
i.e. without providing the full path


I think the patch you have now will not solve the problem for anyone trying to do FC=/full/path/to/compiler while NOT having `/full/path/to` in PATH. May I suggest the following instead:

a) mention it explicitly in http://nwchemgit.github.io/index.php/Compiling_NWChem#Setting_up_the_proper_environment_vari...

i.e. `NWChem does not support usage of the full path in FC and CC variables. Please provide filenames only!'

and

b) throw an error during configure if you found that FC and CC are full paths.


p.s. I fixed the problem on my side by following (a). Thanks for your help in figuring this out.

Gets Around
I recommend that you create an issue on https://github.com/nwchemgit/nwchem/issues and/or submit the appropriate pull requests. You can submit a pull request to the docs via https://github.com/nwchemgit/nwchem-wiki.


Forum >> NWChem's corner >> Compiling NWChem