[MITgcm-support] Compilation with pgi fortran

Gus Correa gus at ldeo.columbia.edu
Thu Jun 19 17:40:03 EDT 2008


Hi Zhi-Ping and list

The "official" Fortran90 namelist terminator is the slash ("/"),
but somehow all namelists in the MITgcm example seem to use the
ampersand ("&") as a terminator (see data, eedata, and other
input parameter files).

Some compilers are lax and take the ampersand also.
PGI was not tolerant, and required the slash as a namelist terminator.
I haven't used the latest PGI versions, so things may have changed.

So depending on the compiler, you have to  replace the namelist terminator
by using the pre-processor directive -DNML_TERMINATOR="/".
This will strip off the ampersand and replace it by slash on all namelists
on the fly when the program runs.

Indeed, as you noticed, I have a blank before the slash.
I don't really remember why, but since it is being overwritten on the
namelist file, the blank is probably there for safety, to avoid 
concatenating
the slash with the last value on the namelist.
So, the blank shouldn't hurt.

Anyway, did you make sure that all the single quotes and double quotes 
in the
pre-processor directives are matched and paired?
The fact that your netcdf library didn't link,
after you changed the build_options file,
suggests to me that maybe the compilation
got lost on quotes that were not paired.

Another thing to check is if all the namelist items are of the form 
name=value,
and that there is comma at the end (except the last item on each namelist).

A more remote possibility, is if you edited your namelist files in a Windows
computer (or an old Mac, or a DOS machine),
and you if are running the experiment on a Linux machine.
The line terminators in those computers are different than Linux,
Parsing input files this way is a total mess.
A couple of computer users here had this problem,
and it was hard to understand what was going on,
until they told me where they had been preparing their input files.

If this is the case, you should edit your files (data, etc) in the Linux 
machine,
or use a line terminator converter.
See this article:

http://en.wikipedia.org/wiki/Newline

Otherwise, please send more details on the error messages.

HIH
Gus Correa

Zhi-Ping Mei wrote:

>Thanks Gus,
>
>
>
>  
>
>>Do you have this line on your build_options file,
>>to define "/" as the namelist terminator?
>>
>>DEFINES='-DWORDLENGTH=4  -DNML_TERMINATOR=" /" '
>>/" '
>>
>>    
>>
>I have -DWORDLENGTH=4, but did not have -DNML_TERMINATOR=" /" '.  So I added -DNML_TERMINATOR=" /" ' to the DEFINES. I see the same problem. 
>
>Do you mean there is a space before /? I tried that either.  When a space is put before /, netcdf library can't be linked.
>
>
>Zhi-Ping
>  
>
>>Zhi-Ping Mei wrote:
>>
>>    
>>
>>>Hell all,
>>>
>>>I am trying to compile MITgcm with PGI fortran. The
>>>      
>>>
>>compilation went fine and the binary mitgcmuv is generated.
>>    
>>
>>>However, when I run the binary, I got following error:
>>>
>>>PGFIO-F-228/namelist read/unit=11/end of file reached
>>>      
>>>
>>without finding group.
>>    
>>
>>>File name = /tmp/FTNcaaaaaDxah    formatted,
>>>      
>>>
>>sequential access   record = 85
>>    
>>
>>>In source file ini_parms.f,PGFIO-F-228/namelist
>>>      
>>>
>>read/unit=11/end of file reached without finding group.
>>    
>>
>>>PGFIO-F-228/namelist read/unit=11/end of file reached
>>>      
>>>
>>without finding group.
>>    
>>
>>>PGFIO-F-228/namelist read/unit=11/end of file reached
>>>      
>>>
>>without finding group.
>>    
>>
>>>at line number 3496
>>>...
>>>
>>>which appears to be related to reading 'data'
>>>
>>>When I compiled with g77, I never encountered such
>>>      
>>>
>>problem. So I suspect it's related to compilation.
>>    
>>
>>>The following is the lines of build options:
>>>===================================
>>>#!/bin/bash
>>>#
>>>#  $Header:
>>>      
>>>
>>/u/gcmpack/MITgcm/tools/build_options/linux_ia32_pgf77+mpi,v
>>1.5 2004/09/25 00:42:14 heimbach Exp $
>>    
>>
>>>#
>>>
>>>FC='mpif77'
>>>CC='mpicc'
>>>LINK='mpif77'
>>>DEFINES='-DALLOW_USE_MPI -DALWAYS_USE_MPI
>>>      
>>>
>>-DWORDLENGTH=4'
>>    
>>
>>>CPP='cpp  -traditional -P'
>>>INCLUDES='-I/usr/local/mpich/1.2.5/ip/up/pgi/ssh/include
>>>      
>>>
>>-I/usr/local/netcdf/pgi/include'
>>    
>>
>>>LIBS='-L/usr/local/mpich/1.2.5/ip/up/pgi/ssh/lib
>>>      
>>>
>>-lfmpich -lmpich -L/usr/local/netcdf/pgi/lib'
>>    
>>
>>>if test "x$IEEE" = x ; then
>>>   #  No need for IEEE-754
>>>   FFLAGS='-byteswapio -r8 -Mnodclchk
>>>      
>>>
>>-Mextend'
>>    
>>
>>>   FOPTIM='-fastsse
>>>      
>>>
>>-Mvect=cachesize:524288,transform'
>>    
>>
>>>else
>>>   #  Try to follow IEEE-754
>>>   FFLAGS='-byteswapio -r8 -Mnodclchk
>>>      
>>>
>>-Mextend'
>>    
>>
>>>   FOPTIM='-O0 -Mvect=sse -Mscalarsse
>>>      
>>>
>>-Mcache_align -Mnoflushz -Kieee'
>>    
>>
>>>fi
>>>
>>>==================================================
>>>
>>>and the following are the lines of job submission
>>>      
>>>
>>script:
>>    
>>
>>>``````````````````````````````````````````````````````````````````````````````````````````
>>>#PBS -S /bin/bash
>>>#PBS -N mitgcmuv
>>>#PBS -l nodes=16:ppn=2
>>>#PBS -l walltime=120:00:00
>>>#PBS -o qsub.output
>>>#PBS -j oe
>>>
>>># torch.mpi Last Modified Jan 16, 2008, Kristian
>>>      
>>>
>>Strickland
>>    
>>
>>># Determine number of processors
>>>NPROCS=`wc -l < $PBS_NODEFILE`
>>>
>>># Pad the log with extra info
>>>echo "PBS: qsub was run on $PBS_O_HOST"
>>>echo "PBS: job \"$PBS_JOBNAME\"
>>>      
>>>
>>submitted while in: $PBS_O_WORKDIR"
>>    
>>
>>>echo "PBS: submitted to queue: $PBS_O_QUEUE,
>>>      
>>>
>>execution in queue: $PBS_QUEUE"
>>    
>>
>>>echo "PBS: execution mode is
>>>      
>>>
>>$PBS_ENVIRONMENT"
>>    
>>
>>>echo "PBS: this job has allocated $NPROCS
>>>      
>>>
>>CPUs"
>>    
>>
>>>## Next two lines for debugging
>>>#echo "PBS: node file is $PBS_NODEFILE and
>>>      
>>>
>>contains one CPU per node listed:"
>>    
>>
>>>#echo `cat $PBS_NODEFILE`
>>>echo "PBS: PATH = $PBS_O_PATH"
>>>echo ----------------------------------------
>>>
>>>export
>>>      
>>>
>>MPICH="/usr/local/mpich/1.2.5/ip/up/pgi/ssh"
>>    
>>
>>>export MPICH_PATH="${MPICH}/bin"
>>>export MPICH_LIB="${MPICH}/lib"
>>>export PATH="${MPICH_PATH}:${PATH}"
>>>export
>>>      
>>>
>>LD_LIBRARY_PATH="${MPICH_LIB}:${LD_LIBRARY_PATH}"
>>    
>>
>>>cd $PBS_O_WORKDIR    
>>>
>>># Run the parallel MPI executable "a.out"
>>>mpirun -machinefile ${PBS_NODEFILE} -np $NPROCS 
>>>      
>>>
>>./${PBS_JOBNAME} 
>>    
>>
>>>#>& out.dat
>>>```````````````````````````````````````````````````````````````````
>>>
>>>I appreciate someone who are familiar with compilation
>>>      
>>>
>>take a look and give me some advices. Thanks in advance,
>>    
>>
>>>Zhi-Ping
>>>
>>>Mount Allison University
>>>New Brunswick
>>>Canda
>>>
>>>
>>>     
>>>_______________________________________________
>>>MITgcm-support mailing list
>>>MITgcm-support at mitgcm.org
>>>http://mitgcm.org/mailman/listinfo/mitgcm-support
>>> 
>>>
>>>      
>>>
>>_______________________________________________
>>MITgcm-support mailing list
>>MITgcm-support at mitgcm.org
>>http://mitgcm.org/mailman/listinfo/mitgcm-support
>>    
>>
>
>
>      
>_______________________________________________
>MITgcm-support mailing list
>MITgcm-support at mitgcm.org
>http://mitgcm.org/mailman/listinfo/mitgcm-support
>  
>




More information about the MITgcm-support mailing list