Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner

Fortran preprocessor stripping off 2 sets of quotes

I am trying to compile a source file which contains the statement compiled = & COMPILATION_DATE with the command mpif90 -save-temps -i8 -g -I. -I/projects/chch5350/Packages/nwchem-6.6/src/include -I/projects/chch5350/Packages/nwchem-6.6/src/tools/install/include -DEXT_INT -DLINUX -DLINUX64 -DPARALLEL_DIAG -DCOMPILATION_DATE="'`date +%a_%b_%d_%H:%M:%S_%Y`'" -DCOMPILATION_DIR="'/projects/chch5350/Packages/nwchem-6.6'" -DNWCHEM_BRANCH="'6.6'" -c -o nwchem.o nwchem.F This produces an error, nwchem.F(471): error #5082: Syntax error, found ':' when expecting one of: ; & Fri_Sep_01_16:24:30_2017 --------------------^ nwchem.F(471): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , ) & Fri_Sep_01_16:24:30_2017 -------------------------------^ nwchem.F(471): error #6404: This name does not have a type, and must have an explicit type. [FRI_SEP_01_16] & Fri_Sep_01_16:24:30_2017 etc. Not surprisingly, the intermediate file nwchem.i shows compiled = & Fri_Sep_01_16:26:18_2017 where the inner quotes that are supposed to be retained in the substitution during preprocessing are being stripped off, so the compiler is interpreting the date string as Fortran syntax. How can I stop that from happening? fpp alone leaves them on, so they are getting stripped off after that. -bash-4.2$ mpif90 --version ifort (IFORT) 17.0.4 20170411 Copyright (C) 1985-2017 Intel Corporation. All rights reserved. -bash-4.2$ uname -a Linux shas0136 3.10.0-327.36.3.el7.x86_64 #1 SMP Thu Oct 20 04:56:07 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux Thanks, Chris
0 Kudos
5 Replies
Highlighted
Beginner

Should have disabled rich

0 Kudos
Highlighted
Black Belt

I guess this is not Intel mpi

I guess this is not Intel mpi so it's not clear who is responsible for preprocessing. You can also try preprocessing in a separate step possibly using gfortran to see if the result works with ifort.
0 Kudos
Highlighted

You might have some success

You might have some success by modifying your make file to use "echo" to construct the

   compiled = "xxx"

statement into a Fortran include file. As an example into "when.fi" and then use the Fortran include statement to include the file in the appropriate line of your program.

Jim Dempsey

0 Kudos
Highlighted
Beginner

Hi Tim,

Hi Tim, The build is using Intel MPI, just redirecting the mpif90 wrapper to ifort. Some further environment info: -bash-4.2$ env ... MKLROOT=/curc/sw/intel/17.4/mkl AR=xiar INTEL_LICENSE_FILE=/curc/sw/intel/17.4/licenses/USE_SERVER.lic CURC_INTEL_BIN=/curc/sw/intel/17.4/bin I_MPI_FABRICS=shm:tmi I_MPI_EXTRA_FILESYSTEM=1 HISTSIZE=1000 CURC_INTEL_INC=/curc/sw/intel/17.4/include MKL_MIC_ARCH=mic TMI_CONFIG=/curc/sw/intel/17.4/impi/2017.3.196/etc64/tmi.conf CURC_INTEL_ROOT=/curc/sw/intel/17.4 HAS_BLAS=yes USE_MPIF=y MIC_LD_LIBRARY_PATH=/curc/sw/intel/17.4/mkl/lib/mic:/curc/sw/intel/17.4/compilers_and_libraries_2017.4.196/linux/mpirt/lib/ia32_lin:/curc/sw/intel/17.4/compilers_and_libraries_2017.4.196/linux/compiler/lib/mic NWCHEM_TOP=/projects/chch5350/Packages/nwchem-6.6 LD_LIBRARY_PATH=/curc/sw/intel/17.4/compiler/lib/intel64:/curc/sw/intel/17.4/mkl/lib/intel64:/curc/sw/intel/17.4/impi/2017.3.196/lib64:/curc/sw/intel/17.4/compilers_and_libraries_2017.4.196/linux/compiler/lib/intel64:/curc/sw/gcc/5.4.0/lib64:/projects/chch5350/lib:: MKL_TARGET_ARCH=intel64 MIC_LIBRARY_PATH=/curc/sw/intel/17.4/compilers_and_libraries_2017.4.196/linux/mpirt/lib/ia32_lin:/curc/sw/intel/17.4/compilers_and_libraries_2017.4.196/linux/compiler/lib/mic USE_MPI=y CXXFLAGS=-xCORE-AVX2 CURC_MKL_LIB=/curc/sw/intel/17.4/mkl/lib/intel64 CURC_IMPI_LIB=/curc/sw/intel/17.4/impi/2017.3.196/lib64 CURC_FAMILY_MPI=impi PATH=/curc/sw/intel/17.4/impi/2017.3.196/bin64:/curc/sw/intel/17.4/compilers_and_libraries_2017.4.196/linux/bin/intel64:/curc/sw/gcc/5.4.0/bin:/projects/chch5350/bin:/usr/lpp/mmfs/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/dell/srvadmin/bin CURC_MKL_BIN=/curc/sw/intel/17.4/mkl/bin I_MPI_EXTRA_FILESYSTEM_LIST=gpfs NWCHEM_MODULES=qm LD=xild CURC_INTEL_LIB=/curc/sw/intel/17.4/lib ARMCI_NETWORK=MPI-PR CURC_MKL_INC=/curc/sw/intel/17.4/mkl/include PWD=/home/chch5350/Projects/Packages/nwchem-6.6/src LOADEDMODULES=intel/17.4:impi/17.3:mkl/17.3 I_MPI_F90=ifort I_MPI_CC=icc USE_OPENMP=T MKL_LP64_ILP64=lp64 CXX=mpicxx I_MPI_HYDRA_PMI_CONNECT=alltoall I_MPI_CXX=icpc CFLAGS=-xCORE-AVX2 FC=mpif90 I_MPI_FC=ifort CURC_IMPI_ROOT=/curc/sw/intel/17.4/impi/2017.3.196 CURC_MKL_ROOT=/curc/sw/intel/17.4/mkl LARGE_FILES=TRUE CURC_FAMILY_COMPILER=intel BLASOPT=-mkl LMOD_FAMILY_COMPILER=intel LMOD_FULL_SETTARG_SUPPORT=no CC=mpicc ARMCI_DEFAULT_SHMMAX=4196 USE_MPIF4=y NWCHEM_TARGET=LINUX64 LMOD_FAMILY_MPI=impi I_MPI_ROOT=/curc/sw/intel/17.4/impi/2017.3.196 Hi Jim, Thanks for the suggestion. However, I would not venture into the wilds of the NWChem source code/build system without an intrepid guide... - Chris

0 Kudos
Highlighted
Beginner

SOLVED, just needed to modify

SOLVED, just needed to modify ( "' ) and ( '" ) nested quotes in the makefile to ( \" ), and build works fine.

0 Kudos