Page 1 of 1
macro definition in vasp6.2.0
Posted: Tue Feb 23, 2021 10:35 pm
by roger_amos1
Hello, the file phonon.F has some neat macro definitions which generate code.
Unfortunately the code does not conform to Fortran Standard, though it compiles with the Intel compilers.
The problem is that it has lines longer than 255 characters. Intel compilers have an extension to allow 2048 line lengths.
Not all compilers allow this.
I can get round this, but the method is a bit inelegant and involves using sed on the .f90 file after preprocessing to insert newline commands.
Does any one have a neater solution?
Re: macro definition in vasp6.2.0
Posted: Wed Feb 24, 2021 8:31 am
by merzuk.kaltak
Hello,
to the best of my knowlegde, ifc, gfortran, nvfortran/pgf90 do not have a problem with phonon.F.
These are the compilers used in our recommended toolchains found
here.
Can you name a specific compiler that has this problem?
Re: macro definition in vasp6.2.0
Posted: Thu Feb 25, 2021 10:19 pm
by roger_amos1
Yes, the Fujitsu compiler, as used on the Fujitsu FX1000 series machines, which currently includes the machine at no. 1 on the top 500.
Re: macro definition in vasp6.2.0
Posted: Thu Feb 25, 2021 10:25 pm
by roger_amos1
And if you want a work-around you can try altering the macros like this:
Code: Select all
#define VASP_TEMPLATE_SETUP_ALLOC_ARR(M_SUFFIX,M_DIM,M_TYPE) \
SUBROUTINE VASP_CONCAT3(SETUP_ALLOC_ARR,M_SUFFIX,M_DIM)(ARR, ALLOC_SIZE) ;\
IMPLICIT NONE ;\
M_TYPE, ALLOCATABLE, INTENT(INOUT) :: VASP_CONCAT(VASP_ARR_,M_DIM) ;\
INTEGER, INTENT(IN) :: VASP_CONCAT(VASP_ALLOC_SIZE_,M_DIM) _NL_ \
IF (ALLOCATED(ARR)) THEN ;\
IF (ANY(SHAPE(ARR) /= ALLOC_SIZE)) THEN ;\
DEALLOCATE(ARR) ;\
ALLOCATE(VASP_CONCAT(VASP_ALLOC_,M_DIM)) ;\
ENDIF _NL_\
ELSE ;\
ALLOCATE(VASP_CONCAT(VASP_ALLOC_,M_DIM)) ;\
ENDIF ;\
END SUBROUTINE
! end of macro definition
Note the extra symbols _NL_ where you want a new line
Then you use an editor, to remove these symbols.
This can be automated in the makefile, but needs phonon.F as a special case
Code: Select all
phonon.o : phonon.F
cpp -P -traditional -DMPI phonon.F > phonon.tmp
sed s/_NL_/\\n/g phonon.tmp > phonon.f90
$(FC) $(FREE) $(FFLAGS) $(INCS) -c phonon.f90