[MITgcm-devel] omp and OMPFLAG

Jean-Michel Campin jmc at mit.edu
Tue Aug 8 08:43:05 EDT 2017


Hi Martin,

I have the impression that you are providing already the answer:
(1) It make more sense to see $OMPFLAG as a compiler flag rather than OPTIM option; 
(2) regarding changing genmake2, how can we be sure that an other compiler will not 
  do the opposite (i.e., requiring OMPFLAG to come before OPTIM option) ?

I did not try, but may be changing the cray optfile by testing env. variable $OMP ?
Just before
  F90FLAGS=$FFLAGS
  F90OPTIM=$FOPTIM
adding something like:
if test "x$OMP" = xtrue ; then
   FOPTIM="$FOPTIM $OMPFLAG"
   OMPFLAG=''
fi

Cheers,
Jean-Michel

On Tue, Aug 08, 2017 at 12:02:17PM +0200, Martin Losch wrote:
> Hi,
> 
> I ran across a problem with omp and a cray compiler. Here???s the background:
> (1) For a cray compiler, omp is defined by default, except for -O0 (no optimization, which is what we normally use when genmake2 is used with -ieee or when you run testreport (even without -devel).
> (2) the order of flags matter, later flags override previous flags.
> The consquence is, that if I want to run testreport I cannot use OpenMP, because the order of flags is
> $FFLAGS (includes $OMPFLAG) $FOPTION (includes optimization flags): -homp ??? -O0
> The latter will reset -homp to -hnoomp.
> I could tweak the build_option file for a cray compiler, but wouldn???t it make more sense to add the OMPFLAG  to FOPTIM in genmake2 (even though it???s stricktly speaking not an optimization flag)?
> 
> Martin
> 
> _______________________________________________
> MITgcm-devel mailing list
> MITgcm-devel at mitgcm.org
> http://mailman.mitgcm.org/mailman/listinfo/mitgcm-devel


More information about the MITgcm-devel mailing list