Skip to content

Commit

Permalink
Merge pull request #14 from electronic-structure/ristretto_cleanup
Browse files Browse the repository at this point in the history
Clean implementation of the API
  • Loading branch information
toxa81 authored Dec 3, 2021
2 parents 19da29b + 1625ce2 commit 1f47141
Show file tree
Hide file tree
Showing 357 changed files with 26,995 additions and 8,284 deletions.
52 changes: 34 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
#enable_language(CXX)
# CMake < 3.13 cannot install external targets:
# https://gitlab.kitware.com/cmake/cmake/merge_requests/2152

Expand Down Expand Up @@ -208,16 +207,6 @@ if(NOT QE_ENABLE_SANITIZER STREQUAL "none" AND NOT CMAKE_Fortran_COMPILER_ID MAT
endif()


###########################################################
# language standard requirements
###########################################################
# TODO need to require all compilers using the same one
if(CMAKE_Fortran_COMPILER_ID MATCHES "PGI" OR CMAKE_Fortran_COMPILER_ID MATCHES "NVHPC")
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
endif()

############################################################
# C preprocessor
# Note: reply on the compiler preprocessor whenever possible
Expand All @@ -239,6 +228,25 @@ else()
message(FATAL_ERROR "C preprocessor ${QE_CPP_SAVED} not found. Pass a working one to CMake via QE_CPP!")
endif()

###########################################################
# language standard requirements
###########################################################
# TODO need to require all compilers using the same one
if(CMAKE_Fortran_COMPILER_ID MATCHES "PGI" OR CMAKE_Fortran_COMPILER_ID MATCHES "NVHPC")
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
endif()

###########################################################
# check Fortran compiler -isystem option support
###########################################################
include(CheckFortranCompilerFlag)
check_fortran_compiler_flag("-isystem ." Fortran_ISYSTEM_SUPPORTED)
if(NOT Fortran_ISYSTEM_SUPPORTED AND NOT DEFINED CMAKE_NO_SYSTEM_FROM_IMPORTED)
set(CMAKE_NO_SYSTEM_FROM_IMPORTED ON)
endif()

############################################################
# Compiler vendor specific options
############################################################
Expand Down Expand Up @@ -292,21 +300,28 @@ qe_install_targets(qe_openmp_fortran qe_openmp_c)
###########################################################
if(QE_ENABLE_OPENMP)
find_package(OpenMP REQUIRED Fortran C)
target_link_libraries(qe_openmp_fortran
INTERFACE OpenMP::OpenMP_Fortran)
target_link_libraries(qe_openmp_c
INTERFACE OpenMP::OpenMP_C)
target_link_libraries(qe_openmp_fortran INTERFACE OpenMP::OpenMP_Fortran)
target_link_libraries(qe_openmp_c INTERFACE OpenMP::OpenMP_C)
endif(QE_ENABLE_OPENMP)

###########################################################
# OpenACC
# The following targets will be defined:
add_library(qe_openacc_fortran INTERFACE)
qe_install_targets(qe_openacc_fortran)
add_library(qe_openacc_c INTERFACE)
qe_install_targets(qe_openacc_fortran qe_openacc_c)
###########################################################
if(QE_ENABLE_OPENACC)
target_link_libraries(qe_openacc_fortran
INTERFACE OpenACC::OpenACC_Fortran)
if(CMAKE_VERSION VERSION_LESS 3.16.0)
message(FATAL_ERROR "CMake versions >= 3.16 required for QE_ENABLE_OPENACC=ON!")
endif()
find_package(OpenACC REQUIRED Fortran C)
target_link_libraries(qe_openacc_fortran INTERFACE OpenACC::OpenACC_Fortran)
target_link_libraries(qe_openacc_c INTERFACE OpenACC::OpenACC_C)
if(GPU_TARGET_COMPILE_OPTIONS)
target_compile_options(qe_openacc_fortran INTERFACE "${GPU_TARGET_COMPILE_OPTIONS}")
target_compile_options(qe_openacc_c INTERFACE "${GPU_TARGET_COMPILE_OPTIONS}")
endif()
endif(QE_ENABLE_OPENACC)

###########################################################
Expand Down Expand Up @@ -334,6 +349,7 @@ find_package(Git 2.13 REQUIRED)
if(EXISTS ${qe_SOURCE_DIR}/.git)
message(STATUS "Source files are cloned from a git repository.")
set(IS_GIT_PROJECT 1)
include(GitInfo)
else()
message(STATUS "Source files are not cloned from a git repository.")
endif()
Expand Down
5 changes: 2 additions & 3 deletions COUPLE/src/libcpv.f90
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ SUBROUTINE f2libcpv(lib_comm,nim,npt,npl,nta,nbn,ndg,retval,infile)
!
CALL mp_startup ( my_world_comm=lib_comm )
ndiag_ = ndg
CALL laxlib_start ( ndiag_, world_comm, intra_bgrp_comm, &
do_distr_diag_inside_bgrp_ = diag_in_band_group_)
CALL laxlib_start ( ndiag_, intra_bgrp_comm, do_distr_diag_inside_bgrp_ = diag_in_band_group_)
CALL set_mpi_comm_4_solvers( intra_pool_comm, intra_bgrp_comm, inter_bgrp_comm)
CALL environment_start ( 'CP' )
!
Expand Down Expand Up @@ -127,7 +126,7 @@ SUBROUTINE f2libcpv(lib_comm,nim,npt,npl,nta,nbn,ndg,retval,infile)
CALL cpr_loop( 1 )
!
CALL laxlib_end()
CALL stop_run()
!CALL stop_run()
retval = 0
!
END SUBROUTINE f2libcpv
2 changes: 1 addition & 1 deletion COUPLE/src/libpwscf.f90
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ SUBROUTINE f2libpwscf(lib_comm,nim,npt,npl,nta,nbn,ndg,retval,infile)
nband=nbn, ndiag=ndg )
CALL mp_startup ( my_world_comm=lib_comm , start_images = .true. )
ndiag_ = ndg
CALL laxlib_start( ndiag_ , lib_comm, intra_pool_comm, do_distr_diag_inside_bgrp_ = .false.)
CALL laxlib_start( ndiag_, intra_pool_comm, do_distr_diag_inside_bgrp_ = .false.)
CALL set_mpi_comm_4_solvers ( intra_pool_comm, intra_bgrp_comm, inter_bgrp_comm)
CALL environment_start ( 'PWSCF' )
!
Expand Down
5 changes: 3 additions & 2 deletions CPV/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set(src_cpv
src/cell_nose.f90
src/cg.f90
src/cg_sub.f90
src/cglib.f90
src/chargedensity.f90
src/cp_autopilot.f90
src/cp_emass.f90
Expand Down Expand Up @@ -117,7 +116,9 @@ target_link_libraries(qe_cpv
qe_mpi_fortran
qe_xclib
qe_device_lapack
qe_devxlib)
qe_devxlib
PUBLIC
qe_openacc_fortran)

###########################################################
# cp.x
Expand Down
8 changes: 8 additions & 0 deletions CPV/Doc/INPUT_CP.def
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,14 @@ input_description -distribution {Quantum Espresso} -package CP -program cp.x {
}
}

var pre_state -type LOGICAL {
default { .FALSE. }
info {
if .TRUE. perform the precondition of the CG gradient
using the kinetic energy of the state.
}
}


var n_inner -type INTEGER {
default { 2 }
Expand Down
Loading

0 comments on commit 1f47141

Please sign in to comment.