[petsc-users] Question on the compiler flags in Makefile

Satish Balay balay at mcs.anl.gov
Mon Dec 1 15:48:51 CST 2014


On Mon, 1 Dec 2014, Danyang Su wrote:

> Hi All,
> 
> I have a PETSc application that need additional compiling flags to build
> Hybrid MPI-OpenMP parallel application on WestGrid Supercomputer (Canada)
> system.
> 
> The code and makefile work fine on my local machine for both Windows and
> Linux, but when compiled on WestGrid Orcinus System for the OpenMP version and
> Hybrid version, the OpenMP parallel part does not take effect while only MPI
> parallel part takes effect. There is no error while compiling the code. I am
> not sure if there is something wrong with the makefile or something other
> setting.
> 
> The compiler flags need to build Hybrid MPI-OpenMP version on WestGrid Orcinus
> is "-shared-intel -openmp -O2 -xSSSE3 -axSSE4.2,SSE4.1 -ip" . For the
> sequential version or MPI parallel version, these flags are not needed.
> 
> Would anybody help to check if the compiler flag (red) in the makefile is
> correct?
> 
> Thanks,
> 
> Danyang
> 
> The makefile is shown below
> 
> include ${PETSC_DIR}/conf/variables
> include ${PETSC_DIR}/conf/rules
> 
> #FC = ifort
> SRC =./../
> 
> # Additional flags that may be required by the compiler ...
> # This is required for the OpenMP parallel version and Hybrid MPI-OpenMP 
> parallel version
> # not necessary for the sequential version and MPI version
> DFCFLAG = -shared-intel -openmp -O2 -xSSSE3 -axSSE4.2,SSE4.1 -ip
> 
> #Flag for WestGrid Orcinus System
> #Load PETSc module before make
> #module load /global/system/Modules/modulefiles/intel-2011/petsc
> FPPFLAGS = -DLINUX -DRELEASE -DPETSC -DMPI -DOPENMP
> 
> SOURCES = $(SRC)gas_advection/relpfsat_g.o\
>         $(SRC)int_h_ovendry.o\
>         $(SRC)dhconst.o\
>         ...
> 
> min3p: $(SOURCES) chkopts
>         -${FLINKER} $(FPPFLAGS) $(DFCFLAG) -o ex $(SOURCES) ${PETSC_LIB} ${DLIB}

You are using DFCFLAG only during link time - and not at compile time.

If you need to specify flags for both compile time and linktime - use FFLAGS

i.e:

FFLAGS = -shared-intel -openmp -O2 -xSSSE3 -axSSE4.2,SSE4.1 -ip
[and remove DFCFLAG]

Also you should specify FFLAGS,FPPFLAGS before the 'incude' directives in the makefile.

Satish




More information about the petsc-users mailing list