work around PGI compiler issues

This commit is contained in:
Axel Kohlmeyer
2020-12-15 14:32:18 -05:00
parent f7dc7e3f3f
commit 65dc5c0351
5 changed files with 13 additions and 8 deletions

View File

@ -220,6 +220,7 @@ if(BUILD_OMP)
endif()
if (((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR
((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0)))
# GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts.

View File

@ -375,7 +375,11 @@ struct ostream_params {
};
} // namespace detail
#if defined(__PGI)
static detail::buffer_size buffer_size;
#else
static constexpr detail::buffer_size buffer_size;
#endif
// A fast output stream which is not thread-safe.
class ostream final : private detail::buffer<char> {

View File

@ -268,6 +268,8 @@ The typecasts prevent compiler warnings about possible truncation issues.
# define _noopt __attribute__((optnone))
#elif defined(__INTEL_COMPILER)
# define _noopt
#elif defined(__PGI)
# define _noopt
#elif defined(__GNUC__)
# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9))
# if defined(_FORTIFY_SOURCE) && (_FORTIFY_SOURCE > 0)

View File

@ -1,12 +1,12 @@
MODULE keepcmds
USE liblammps
TYPE(LAMMPS) :: lmp
CHARACTER(len=*), DIMENSION(*), PARAMETER :: demo_input = &
CHARACTER(len=40), DIMENSION(3), PARAMETER :: demo_input = &
[ CHARACTER(len=40) :: &
'region box block 0 $x 0 2 0 2', &
'create_box 1 box', &
'create_atoms 1 single 1.0 1.0 ${zpos}' ]
CHARACTER(len=*), DIMENSION(*), PARAMETER :: cont_input = &
CHARACTER(len=40), DIMENSION(2), PARAMETER :: cont_input = &
[ CHARACTER(len=40) :: &
'create_atoms 1 single &', &
' 0.2 0.1 0.1' ]
@ -19,7 +19,7 @@ FUNCTION f_lammps_with_args() BIND(C, name="f_lammps_with_args")
IMPLICIT NONE
TYPE(c_ptr) :: f_lammps_with_args
CHARACTER(len=*), DIMENSION(*), PARAMETER :: args = &
CHARACTER(len=12), DIMENSION(12), PARAMETER :: args = &
[ CHARACTER(len=12) :: 'liblammps', '-log', 'none', &
'-echo','screen','-nocite','-var','zpos','1.5','-var','x','2']

View File

@ -22,7 +22,7 @@ FUNCTION f_lammps_no_mpi_with_args() BIND(C, name="f_lammps_no_mpi_with_args")
IMPLICIT NONE
TYPE(c_ptr) :: f_lammps_no_mpi_with_args
CHARACTER(len=*), DIMENSION(*), PARAMETER :: args = &
CHARACTER(len=12), DIMENSION(4), PARAMETER :: args = &
[ CHARACTER(len=12) :: 'liblammps', '-log', 'none', '-nocite' ]
lmp = lammps(args)
@ -54,7 +54,7 @@ FUNCTION f_lammps_open_with_args() BIND(C, name="f_lammps_open_with_args")
TYPE(c_ptr) :: f_lammps_open_with_args
INTEGER :: color, key, ierr
CHARACTER(len=*), DIMENSION(*), PARAMETER :: args = &
CHARACTER(len=12), DIMENSION(4), PARAMETER :: args = &
[ CHARACTER(len=12) :: 'liblammps', '-log', 'none', '-nocite' ]
color = 2
@ -73,7 +73,7 @@ SUBROUTINE f_lammps_close() BIND(C, name="f_lammps_close")
CALL lmp%close()
lmp%handle = c_null_ptr
END SUBROUTINE f_lammps_close
FUNCTION f_lammps_get_comm() BIND(C, name="f_lammps_get_comm")
USE liblammps
USE keepcreate, ONLY: mycomm
@ -82,5 +82,3 @@ FUNCTION f_lammps_get_comm() BIND(C, name="f_lammps_get_comm")
f_lammps_get_comm = mycomm
END FUNCTION f_lammps_get_comm