cancel
Showing results for 
Search instead for 
Did you mean: 

Server Processors

pkiwan
Journeyman III

Some simple questions for parallel computation with AOCC compiler

Dear all:

 

I am trying to use Pencil code for the magnetohydrodynamic simulation.

By default, it uses mpif90 suit for the Intel compiler.

If I use GCC or some other compilers on an AMD machine, the code works too slowly.

How can I change "Makefile" in the code for the parallel computation?

For your reference, the related content in Makefile is as follows:

 

-----------------------------------------------------------------------------------------------------

# Default compiler settings.
AR = ar
FC = mpif90
FFLAGS =
F90FLAGS =
F77 = f90
F77FLAGS =
CFLAGS =
FCCLEANER =
MAKEOPTS =
CONVERSION_RELAXED =
#
# Defaults for external libraries.
#
CFLAGS_FFTW3 =
FFLAGS_FFTW3 =
LD_FFTW3 =
CFLAGS_FFTW2 =
FFLAGS_FFTW2 =
LD_FFTW2 =
#
# Extra compiler flags (what does the `GENERAL' refer to?). MR: could be renamed to EXTRA
#
FFLAGS_GENERAL =
CFLAGS_GENERAL =
#
# Preprocessing flags.
#
FPPFLAGS =
#
# Default double flags (can be overwritten in machine-specific section).
#
FFLAGS_DOUBLE = -r8
CFLAGS_DOUBLE = -DDOUBLE_PRECISION
#
# Default linker flags.
#
ifeq ($(LDFLAGS),)
LDFLAGS = -ldl
else
LDFLAGS += -ldl
endif

# Caution:
# This file has been created from `Makefile.src' and will be overwritten the
# next time `adapt-mkfile' is called. If you're about to make non-trivial
# changes, you probably want to edit the master file instead.

DLL_FFLAGS ?= -fPIC
DLL_LDFLAGS ?= -shared
#
# Overwrite settings that are local to each run directory.
#
include Makefile.local
#
# Double precision settings and similar. Must be included _after_
# Makefile.local, so we can set REAL_PRECISION=double there.
#
include Makefile.inc
#
# Fortran 2003 standard compilation settings.
#
include Makefile-standard.inc
#

0 Likes
3 Replies
vtangutu
Staff

Hi @pkiwan 

Thank you for writing to Server guru. We will look into the issue and get back to you 

Best Regards
Hemanth

0 Likes
vtangutu
Staff

Hi @pkiwan 


Can you please try out the AOCC compiler which is optimized for AMD Hardware.

AOCC Compiler link: https://www.amd.com/en/developer/aocc.html
Download link : https://www.amd.com/en/developer/aocc.html#downloads
AOCC User guide: https://www.amd.com/content/dam/amd/en/documents/developer/version-4-1-documents/aocc/aocc-4.1-user-...

There is already a config file for AOCC AMD_flang.conf in config/compilers/separate/ folder Use the same to build pencil-code for AOCC.
Note: you do need to build MPI with AOCC prior to that.

Build steps:

  • Set PENCIL_HOME environment variable
  • Add PENCIL_HOME/bin to PATH
  • copy config/compilers/separate/AMD_Flang.conf to config/compilers
  • goto src directory
  • Build with "pc_build -f AMD_Flang" command

Please check the flags that can be used for optimization in the user guide in section 5.3 in AOCC user guide.

Add the desired optimization flags in FFLAGS and CFLAGS variable in makefile section in AMD_Flang.conf file.

Please feel free to reach out if you have any queries

Best Regards
Hemanth

0 Likes
vtangutu
Staff

Hi @pkiwan 

Did you get a chance to try above suggestions
Please feel free to reach out if you have any queries

Best Regards
Hemanth

0 Likes