diff --git a/configure b/configure index c26eb7d3..376ac572 100755 --- a/configure +++ b/configure @@ -43,6 +43,7 @@ except KeyError: QP_ROOT_BIN = join(QP_ROOT, "bin") QP_ROOT_LIB = join(QP_ROOT, "lib") +QP_ROOT_LIB64 = join(QP_ROOT, "lib64") QP_ROOT_INSTALL = join(QP_ROOT, "install") os.environ["PATH"] = os.environ["PATH"] + ":" + QP_ROOT_BIN @@ -65,6 +66,7 @@ d_dependency = { "python": [], "ninja": ["g++", "python"], "make": [], + "gpi2": ["g++", "make"], "p_graphviz": ["python"], "bats": [] } @@ -140,6 +142,11 @@ f77zmq = Info( description=' F77-ZeroMQ', default_path=join(QP_ROOT_LIB, "libf77zmq.a") ) +gpi2 = Info( + url='https://github.com/cc-hpc-itwm/GPI-2/archive/v1.3.0.tar.gz', + description=' GPI-2', + default_path=join(QP_ROOT_LIB64, "libGPI2.a") ) + p_graphviz = Info( url='https://github.com/xflr6/graphviz/archive/master.tar.gz', description=' Python library for graphviz', @@ -154,7 +161,7 @@ d_info = dict() for m in ["ocaml", "m4", "curl", "zlib", "patch", "irpf90", "docopt", "resultsFile", "ninja", "emsl", "ezfio", "p_graphviz", - "zeromq", "f77zmq","bats"]: + "zeromq", "f77zmq", "bats", "gpi2"]: exec ("d_info['{0}']={0}".format(m)) @@ -481,8 +488,8 @@ def create_ninja_and_rc(l_installed): 'export NINJA={0}'.format(path_ninja.replace(QP_ROOT,"${QP_ROOT}")), 'export PYTHONPATH="${QP_EZFIO}/Python":"${QP_PYTHON}":"${PYTHONPATH}"', 'export PATH="${QP_PYTHON}":"${QP_ROOT}"/bin:"${QP_ROOT}"/ocaml:"${PATH}"', - 'export LD_LIBRARY_PATH="${QP_ROOT}"/lib:"${LD_LIBRARY_PATH}"', - 'export LIBRARY_PATH="${QP_ROOT}"/lib:"${LIBRARY_PATH}"', + 'export LD_LIBRARY_PATH="${QP_ROOT}"/lib:${QP_ROOT}"/lib64:"${LD_LIBRARY_PATH}"', + 'export LIBRARY_PATH="${QP_ROOT}"/lib:${QP_ROOT}"/lib64:"${LIBRARY_PATH}"', 'export C_INCLUDE_PATH="${C_INCLUDE_PATH}":"${QP_ROOT}"/include', '', 'source ${QP_ROOT}/install/EZFIO/Bash/ezfio.sh', diff --git a/install/scripts/install_gpi2.sh b/install/scripts/install_gpi2.sh new file mode 100755 index 00000000..751f4ef8 --- /dev/null +++ b/install/scripts/install_gpi2.sh @@ -0,0 +1,15 @@ +#!/bin/bash -x + +TARGET=gpi2 +#GPI_OPTIONS=--with-infiniband +GPI_OPTIONS=--with-ethernet + +function _install() +{ + cd gpi2 + ./install.sh -p $QP_ROOT $GPI_OPTIONS + cp src/GASPI.f90 $QP_ROOT/src/plugins/GPI2/ + return 0 +} + +source scripts/build.sh diff --git a/plugins/GPI2/NEEDED_CHILDREN_MODULES b/plugins/GPI2/NEEDED_CHILDREN_MODULES new file mode 100644 index 00000000..aae89501 --- /dev/null +++ b/plugins/GPI2/NEEDED_CHILDREN_MODULES @@ -0,0 +1 @@ +Determinants diff --git a/plugins/GPI2/README.rst b/plugins/GPI2/README.rst new file mode 100644 index 00000000..d6be4958 --- /dev/null +++ b/plugins/GPI2/README.rst @@ -0,0 +1,14 @@ +===== +GASPI +===== + +Providers for GASPI programs (with the GPI2 library). + +Needed Modules +============== +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. +Documentation +============= +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. diff --git a/plugins/GPI2/gpi_test.irp.f b/plugins/GPI2/gpi_test.irp.f new file mode 100644 index 00000000..1fc109e6 --- /dev/null +++ b/plugins/GPI2/gpi_test.irp.f @@ -0,0 +1,13 @@ +program test + double precision :: energy(N_states) + if (is_gaspi_master) then + energy = 1.d0 + else + energy = 0.d0 + endif + call broadcast_wf(energy) + print *, 'energy (1.d0) :', GASPI_rank, energy(1) + print *, 'coef :', GASPI_rank, psi_coef(1,1) + print *, 'det :', GASPI_rank, psi_det (1,1,1) + call gaspi_finalize +end diff --git a/plugins/GPI2/utils.irp.f b/plugins/GPI2/utils.irp.f new file mode 100644 index 00000000..cfb17b75 --- /dev/null +++ b/plugins/GPI2/utils.irp.f @@ -0,0 +1,76 @@ + BEGIN_PROVIDER [ logical, GASPI_is_initialized ] +&BEGIN_PROVIDER [ logical, has_gaspi ] + implicit none + BEGIN_DOC +! This is true when GASPI_Init has been called + END_DOC + + has_gaspi = .False. + IRP_IF GASPI + use GASPI + integer(gaspi_return_t) :: res + res = gaspi_proc_init(GASPI_BLOCK) + if (res /= GASPI_SUCCESS) then + print *, res + print *, 'GASPI failed to initialize' + stop -1 + endif + has_gaspi = .True. + IRP_ENDIF + GASPI_is_initialized = .True. +END_PROVIDER + + + BEGIN_PROVIDER [ integer, GASPI_rank ] +&BEGIN_PROVIDER [ integer, GASPI_size ] +&BEGIN_PROVIDER [ logical, is_GASPI_master ] + implicit none + BEGIN_DOC +! Usual GASPI variables + END_DOC + + PROVIDE GASPI_is_initialized + + IRP_IF GASPI + use GASPI + integer(gaspi_return_t) :: res + integer(gaspi_rank_t) :: n + res = gaspi_proc_num(n) + GASPI_size = n + if (res /= GASPI_SUCCESS) then + print *, res + print *, 'Unable to get GASPI_size' + stop -1 + endif + res = gaspi_proc_rank(n) + GASPI_rank = n + if (res /= GASPI_SUCCESS) then + print *, res + print *, 'Unable to get GASPI_rank' + stop -1 + endif + is_GASPI_master = (GASPI_rank == 0) + IRP_ELSE + GASPI_rank = 0 + GASPI_size = 1 + is_GASPI_master = .True. + IRP_ENDIF + + +END_PROVIDER + +subroutine gaspi_finalize() + implicit none + PROVIDE GASPI_is_initialized + IRP_IF GASPI + use GASPI + integer(gaspi_return_t) :: res + res = gaspi_proc_term(GASPI_BLOCK) + if (res /= GASPI_SUCCESS) then + print *, res + print *, 'Unable to finalize GASPI' + stop -1 + endif + IRP_ENDIF +end subroutine + diff --git a/scripts/compilation/qp_create_ninja.py b/scripts/compilation/qp_create_ninja.py index 780a7a91..56d79a4b 100755 --- a/scripts/compilation/qp_create_ninja.py +++ b/scripts/compilation/qp_create_ninja.py @@ -96,7 +96,8 @@ def ninja_create_env_variable(pwd_config_file): l_string.append(str_) lib_lapack = get_compilation_option(pwd_config_file, "LAPACK_LIB") - str_lib = " ".join([LIB, lib_lapack, EZFIO_LIB, ZMQ_LIB]) + lib_gpi2 = get_compilation_option(pwd_config_file, "GPI2_LIB") + str_lib = " ".join([LIB, lib_lapack, lib_gpi2, EZFIO_LIB, ZMQ_LIB]) l_string.append("LIB = {0} ".format(str_lib)) l_string.append("") diff --git a/scripts/compilation/read_compilation_cfg.py b/scripts/compilation/read_compilation_cfg.py index f3ca01ce..43a64631 100755 --- a/scripts/compilation/read_compilation_cfg.py +++ b/scripts/compilation/read_compilation_cfg.py @@ -37,7 +37,8 @@ def get_compilation_option(pwd_cfg, flag_name): if __name__ == '__main__': qpackage_root = os.environ['QP_ROOT'] - pwd_cfg = os.path.join(qpackage_root, "config/gfortran_example.cfg") + pwd_cfg = os.path.join(qpackage_root, "config/ifort_gpi2.cfg") print get_compilation_option(pwd_cfg, "FC") print get_compilation_option(pwd_cfg, "FCFLAGS") + print get_compilation_option(pwd_cfg, "GPI2_LIB")