Commit 9233720a authored by Marek, Andreas (amarek)'s avatar Marek, Andreas (amarek)

Merge branch 'fix_omp' into 'master_pre_stage'

Fix omp

See merge request !12
parents 57c4bada e867741a
......@@ -48,7 +48,7 @@ static-build:
tags:
- avx
script:
- ./ci_test_scripts/run_ci_tests.sh -c " CFLAGS=\"-O3 -mavx\" FCFLAGS=\"-O3 -axAVX\" SCALAPACK_LDFLAGS=\"$MKL_INTEL_SCALAPACK_LDFLAGS_NO_MPI_NO_OMP\" SCALAPACK_FCFLAGS=\"$MKL_INTEL_SCALAPACK_FCFLAGS_NO_MPI_NO_OMP\" --with-mpi=no FC=ifort --enable-shared=no --enable-static=yes --disable-avx2 || { cat config.log; exit 1; } " -j 8 -t 2 -m 150 -n 50 -b 16 -s $SKIP_STEP -i $INTERACTIVE_RUN -S $SLURM
- ./ci_test_scripts/run_ci_tests.sh -c " CFLAGS=\"-O3 -mavx\" FCFLAGS=\"-O3 -axAVX\" SCALAPACK_LDFLAGS=\"$MKL_INTEL_SCALAPACK_LDFLAGS_NO_MPI_NO_OMP\" SCALAPACK_FCFLAGS=\"$MKL_INTEL_SCALAPACK_FCFLAGS_NO_MPI_NO_OMP\" --with-mpi=no FC=ifort --enable-shared=no --enable-static=yes --disable-avx2 --enable-optional-argument-in-C-API || { cat config.log; exit 1; } " -j 8 -t 2 -m 150 -n 50 -b 16 -s $SKIP_STEP -i $INTERACTIVE_RUN -S $SLURM
......
......@@ -40,6 +40,7 @@ libelpa@SUFFIX@_private_la_SOURCES = \
src/helpers/mod_precision.F90 \
src/helpers/mod_mpi.F90 \
src/helpers/mod_mpi_stubs.F90 \
src/helpers/mod_omp.F90 \
src/elpa_generated_fortran_interfaces.F90 \
src/elpa2/mod_redist_band.F90 \
src/elpa2/mod_pack_unpack_cpu.F90 \
......@@ -454,6 +455,7 @@ nobase_nodist_elpa_include_HEADERS = \
elpa/elpa_version.h \
elpa/elpa_constants.h \
elpa/elpa_generated.h \
elpa/elpa_generated_c_api.h \
elpa/elpa_generated_legacy.h
dist_man_MANS = \
......@@ -685,7 +687,8 @@ test_python.sh:
include doxygen.am
CLEANFILES = \
elpa-generated.h \
elpa_generated.h \
elpa_generated_c_api.h \
elpa1_test* \
elpa2_test*\
elpa2_real* \
......@@ -717,16 +720,14 @@ clean-local:
-rm -rf $(generated_headers)
distclean-local:
-rm -rf ./m4
-rm -rf ./src
-rm -rf ./test
-rm -rf ./modules
-rm -rf .fortran_dependencies
-rm config-f90.h
-rm -rf ./src/elpa2/kernels/.deps
-rm -rf ./src/.deps
-rm -rf ./test/.deps
-rmdir ./src/elpa2/kernels/
-rmdir ./src
-rmdir ./test
-rmdir ./m4
-rmdir modules/
-rmdir .fortran_dependencies/
-rm -rf elpa/elpa_generated_c_api.h
EXTRA_DIST = \
elpa.spec \
......
......@@ -319,7 +319,7 @@ print(" tags:")
print(" - avx")
print(" script:")
print(" - ./ci_test_scripts/run_ci_tests.sh -c \" CFLAGS=\\\"-O3 -mavx\\\" FCFLAGS=\\\"-O3 -axAVX\\\" SCALAPACK_LDFLAGS=\\\"$MKL_INTEL_SCALAPACK_LDFLAGS_NO_MPI_NO_OMP\\\" \
SCALAPACK_FCFLAGS=\\\"$MKL_INTEL_SCALAPACK_FCFLAGS_NO_MPI_NO_OMP\\\" --with-mpi=no FC=ifort --enable-shared=no --enable-static=yes --disable-avx2 || { cat config.log; exit 1; } \" -j 8 \
SCALAPACK_FCFLAGS=\\\"$MKL_INTEL_SCALAPACK_FCFLAGS_NO_MPI_NO_OMP\\\" --with-mpi=no FC=ifort --enable-shared=no --enable-static=yes --disable-avx2 --enable-optional-argument-in-C-API || { cat config.log; exit 1; } \" -j 8 \
-t 2 -m 150 -n 50 -b 16 -s $SKIP_STEP -i $INTERACTIVE_RUN -S $SLURM ")
print("\n\n")
......
......@@ -68,6 +68,24 @@ if test x"${enable_legacy}" = x"yes"; then
AC_DEFINE([ENABLE_LEGACY], [1], [enable legacy interface])
fi
AC_MSG_CHECKING(whether in C interface the error argument should be optional)
AC_ARG_ENABLE([optional-argument-in-C-API],
AS_HELP_STRING([--enable-optional-argument-in-C-API],
[do not build C API with error argument as optional, default no]),
[
if test x"$enableval" = x"yes"; then
optional_c_error_argument=yes
else
optional_c_error_argument=no
fi
],
[optional_c_error_argument=no])
AC_MSG_RESULT([${optional_c_error_argument}])
AM_CONDITIONAL([OPTIONAL_C_ERROR_ARGUMENT],[test x"$enable_legacy" = x"yes"])
if test x"${optional_c_error_argument}" = x"yes"; then
AC_DEFINE([OPTIONAL_C_ERROR_ARGUMENT], [1], [enable error argument in C-API to be optional])
fi
# gnu-make fortran module dependencies
m4_include([fdep/fortran_dependencies.m4])
......@@ -1454,5 +1472,11 @@ if test x"$enable_kcomputer" = x"yes" ; then
echo "call: make -f ../generated_headers.am generated-headers top_srcdir=.."
echo "BEFORE triggering the build with make!"
else
if test x"$optional_c_error_argument" = x"yes" ; then
echo "#define OPTIONAL_C_ERROR_ARGUMENT" > elpa/elpa_generated_c_api.h
else
echo "#undef OPTIONAL_C_ERROR_ARGUMENT" > elpa/elpa_generated_c_api.h
fi
make -f $srcdir/generated_headers.am generated-headers top_srcdir="$srcdir" CPP="$CPP"
fi
......@@ -14,6 +14,7 @@ typedef struct elpa_autotune_struct *elpa_autotune_t;
#include <elpa/elpa_constants.h>
#include <elpa/elpa_generated_c_api.h>
#include <elpa/elpa_generated.h>
#include <elpa/elpa_generic.h>
......
......@@ -22,6 +22,22 @@ elpa/elpa_generated.h: $(top_srcdir)/src/elpa_impl.F90 \
$(top_srcdir)/src/elpa_api.F90 | elpa
@rm -f $@
$(call extract_interface,!c>)
$(call extract_interface,!c_o>)
$(call extract_interface,!c_no>)
#if OPTIONAL_C_ERROR_ARGUMENT
#
#elpa/elpa_generated.h: $(top_srcdir)/src/elpa_impl.F90 \
# $(top_srcdir)/src/elpa_impl_math_template.F90 \
# $(top_srcdir)/src/elpa_api.F90 | elpa
# $(call extract_interface,!c_o>)
#
#else
#elpa/elpa_generated.h: $(top_srcdir)/src/elpa_impl.F90 \
# $(top_srcdir)/src/elpa_impl_math_template.F90 \
# $(top_srcdir)/src/elpa_api.F90 | elpa
# $(call extract_interface,!c_no>)
#endif
generated_headers += elpa/elpa_generated_legacy.h
elpa/elpa_generated_legacy.h: $(top_srcdir)/src/elpa_driver/legacy_interface/elpa_driver_c_interface.F90 \
......
......@@ -66,9 +66,8 @@ function elpa_solve_evp_&
use elpa_abstract_impl
use elpa_mpi
use elpa1_compute
#ifdef WITH_OPENMP
use omp_lib
#endif
use elpa_omp
implicit none
#include "../general/precision_kinds.F90"
class(elpa_abstract_impl_t), intent(inout) :: obj
......@@ -122,7 +121,11 @@ function elpa_solve_evp_&
&")
#ifdef WITH_OPENMP
!nrThreads = omp_get_max_threads()
! store the number of OpenMP threads used in the calling function
! restore this at the end of ELPA 2
omp_threads_caller = omp_get_max_threads()
! check the number of threads that ELPA should use internally
call obj%get("omp_threads",nrThreads,error)
call omp_set_num_threads(nrThreads)
#else
......@@ -156,6 +159,13 @@ function elpa_solve_evp_&
if (.not.(obj%eigenvalues_only)) then
q(1,1) = ONE
endif
! restore original OpenMP settings
#ifdef WITH_OPENMP
! store the number of OpenMP threads used in the calling function
! restore this at the end of ELPA 2
call omp_set_num_threads(omp_threads_caller)
#endif
call obj%timer%stop("elpa_solve_evp_&
&MATH_DATATYPE&
&_1stage_&
......@@ -411,6 +421,13 @@ function elpa_solve_evp_&
endif
endif
! restore original OpenMP settings
#ifdef WITH_OPENMP
! store the number of OpenMP threads used in the calling function
! restore this at the end of ELPA 2
call omp_set_num_threads(omp_threads_caller)
#endif
call obj%timer%stop("elpa_solve_evp_&
&MATH_DATATYPE&
&_1stage_&
......
......@@ -102,9 +102,8 @@ call prmat(na,useGpu,a_mat,a_dev,lda,matrixCols,nblk,my_prow,my_pcol,np_rows,np_
use precision
use elpa_abstract_impl
use matrix_plot
#ifdef WITH_OPENMP
use omp_lib
#endif
use elpa_omp
implicit none
#include "../general/precision_kinds.F90"
class(elpa_abstract_impl_t), intent(inout) :: obj
......
......@@ -48,9 +48,8 @@
use elpa_mpi
use precision
use elpa_abstract_impl
#ifdef WITH_OPENMP
use omp_lib
#endif
use elpa_omp
implicit none
#include "../general/precision_kinds.F90"
class(elpa_abstract_impl_t), intent(inout) :: obj
......@@ -80,7 +79,11 @@
&")
#ifdef WITH_OPENMP
!nrThreads=omp_get_max_threads()
! store the number of OpenMP threads used in the calling function
! restore this at the end of ELPA 2
omp_threads_caller = omp_get_max_threads()
! check the number of threads that ELPA should use internally
call obj%get("omp_threads",nrThreads,error)
call omp_set_num_threads(nrThreads)
#else
......@@ -333,6 +336,14 @@
a(l_row1:l_rows,l_col1) = 0
endif
enddo
! restore original OpenMP settings
#ifdef WITH_OPENMP
! store the number of OpenMP threads used in the calling function
! restore this at the end of ELPA 2
call omp_set_num_threads(omp_threads_caller)
#endif
call obj%timer%stop("elpa_cholesky_&
&MATH_DATATYPE&
&_&
......
......@@ -63,9 +63,7 @@
&_impl
use precision
use elpa_abstract_impl
#ifdef WITH_OPENMP
use omp_lib
#endif
use elpa_omp
implicit none
class(elpa_abstract_impl_t), intent(inout) :: obj
......@@ -95,7 +93,12 @@
matrixCols = obj%local_ncols
#ifdef WITH_OPENMP
!nrThreads=omp_get_max_threads()
! store the number of OpenMP threads used in the calling function
! restore this at the end of ELPA 2
omp_threads_caller = omp_get_max_threads()
! check the number of threads that ELPA should use internally
call obj%get("omp_threads",nrThreads,error)
#else
nrThreads=1
......@@ -130,6 +133,15 @@
mpi_comm_rows, mpi_comm_cols,.false., wantDebug, success, &
nrThreads)
! restore original OpenMP settings
#ifdef WITH_OPENMP
! store the number of OpenMP threads used in the calling function
! restore this at the end of ELPA 2
call omp_set_num_threads(omp_threads_caller)
#endif
call obj%timer%stop("elpa_solve_tridi_public_&
&MATH_DATATYPE&
&_&
......
......@@ -62,9 +62,8 @@
&_impl
use elpa
use elpa_abstract_impl
#ifdef WITH_OPENMP
use omp_lib
#endif
use elpa_omp
implicit none
integer(kind=ik) :: na, nev, ldq, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols
real(kind=REAL_DATATYPE) :: d(na), e(na)
......@@ -148,6 +147,12 @@
endif
#ifdef WITH_OPENMP
! store the number of OpenMP threads used in the calling function
! restore this at the end of ELPA 2
omp_threads_caller = omp_get_max_threads()
! check the number of threads that ELPA should use internally
nrThreads = omp_get_max_threads()
call obj%set("omp_threads", nrThreads, error)
#else
......@@ -167,6 +172,12 @@
if (error /= ELPA_OK) then
print *, "Cannot run solve_tridi"
success = .false.
! restore original OpenMP settings
#ifdef WITH_OPENMP
! store the number of OpenMP threads used in the calling function
! restore this at the end of ELPA 2
call omp_set_num_threads(omp_threads_caller)
#endif
return
else
success = .true.
......@@ -184,6 +195,13 @@
! stop
endif
! restore original OpenMP settings
#ifdef WITH_OPENMP
! store the number of OpenMP threads used in the calling function
! restore this at the end of ELPA 2
call omp_set_num_threads(omp_threads_caller)
#endif
!call timer%stop("elpa_solve_tridi_&
!&PRECISION&
!&_legacy_interface")
......
......@@ -63,9 +63,8 @@
use elpa_mpi
use cuda_functions
use mod_check_for_gpu
#ifdef WITH_OPENMP
use omp_lib
#endif
use elpa_omp
use iso_c_binding
implicit none
#include "../general/precision_kinds.F90"
......@@ -150,7 +149,11 @@
#ifdef WITH_OPENMP
!nrThreads = omp_get_max_threads()
! store the number of OpenMP threads used in the calling function
! restore this at the end of ELPA 2
omp_threads_caller = omp_get_max_threads()
! check the number of threads that ELPA should use internally
call obj%get("omp_threads",nrThreads,error)
call omp_set_num_threads(nrThreads)
#else
......@@ -209,6 +212,14 @@
if (.not.(obj%eigenvalues_only)) then
q(1,1) = ONE
endif
! restore original OpenMP settings
#ifdef WITH_OPENMP
! store the number of OpenMP threads used in the calling function
! restore this at the end of ELPA 2
call omp_set_num_threads(omp_threads_caller)
#endif
call obj%timer%stop("elpa_solve_evp_&
&MATH_DATATYPE&
&_2stage_&
......@@ -779,6 +790,13 @@
endif
endif
! restore original OpenMP settings
#ifdef WITH_OPENMP
! store the number of OpenMP threads used in the calling function
! restore this at the end of ELPA 2
call omp_set_num_threads(omp_threads_caller)
#endif
call obj%timer%stop("elpa_solve_evp_&
&MATH_DATATYPE&
&_2stage_&
......
......@@ -817,20 +817,49 @@ module elpa_api
api_version = api_version_set
end function
#ifdef OPTIONAL_C_ERROR_ARGUMENT
!c_o> #ifdef OPTIONAL_C_ERROR_ARGUMENT
!c_o> #define elpa_uninit(...) CONC(elpa_uninit, NARGS(__VA_ARGS__))(__VA_ARGS__)
!c_o> #endif
#endif
!> \brief subroutine to uninit the ELPA library. Does nothing at the moment. Might do sth. later
!
!c> void elpa_uninit(int *error);
subroutine elpa_uninit(error) bind(C, name="elpa_uninit")
#ifdef OPTIONAL_C_ERROR_ARGUMENT
!c_o> #ifdef OPTIONAL_C_ERROR_ARGUMENT
!c_o> void elpa_uninit1(int *error);
!c_o> void elpa_uninit0();
!c_o> #endif
subroutine elpa_uninit_c1(error) bind(C, name="elpa_uninit1")
integer(kind=c_int) :: error
call elpa_uninit(error)
end subroutine
subroutine elpa_uninit_c0() bind(C, name="elpa_uninit0")
call elpa_uninit()
end subroutine
#else
!c_no> #ifndef OPTIONAL_C_ERROR_ARGUMENT
!c_no> void elpa_uninit(int *error);
!c_no> #endif
subroutine elpa_uninit_c(error) bind(C, name="elpa_uninit")
integer(kind=c_int) :: error
call elpa_uninit(error)
end subroutine
#endif
subroutine elpa_uninit(error)
#ifdef USE_FORTRAN2008
integer, optional, intent(out) :: error
integer, optional, intent(out) :: error
#else
integer, intent(out) :: error
integer, intent(out) :: error
#endif
#ifdef USE_FORTRAN2008
if (present(error)) then
error = ELPA_OK
return
endif
#endif
if (present(error)) error = ELPA_OK
end subroutine
!> \brief helper function for error strings
!> Parameters
!> \param elpa_error integer: error code to querry
......
......@@ -215,30 +215,93 @@ module elpa_impl
endif
end function
#ifdef OPTIONAL_C_ERROR_ARGUMENT
!c_o> #ifdef OPTIONAL_C_ERROR_ARGUMENT
!c_o> #define elpa_allocate(...) CONC(elpa_allocate, NARGS(__VA_ARGS__))(__VA_ARGS__)
!c_o> #endif
#endif
!c> /*! \brief C interface for the implementation of the elpa_allocate method
!c> *
!c> * \param none
!c> * \result elpa_t handle
!c> */
!c> elpa_t elpa_allocate(int *error);
function elpa_impl_allocate_c(error) result(ptr) bind(C, name="elpa_allocate")
integer(kind=c_int) :: error
type(c_ptr) :: ptr
#ifdef OPTIONAL_C_ERROR_ARGUMENT
!c_o> #ifdef OPTIONAL_C_ERROR_ARGUMENT
!c_o> elpa_t elpa_allocate2(int *error);
!c_o> elpa_t elpa_allocate1();
!c_o> #endif
function elpa_impl_allocate_c1() result(ptr) bind(C, name="elpa_allocate1")
type(c_ptr) :: ptr
type(elpa_impl_t), pointer :: obj
obj => elpa_impl_allocate()
ptr = c_loc(obj)
end function
function elpa_impl_allocate_c2(error) result(ptr) bind(C, name="elpa_allocate2")
integer(kind=c_int) :: error
type(c_ptr) :: ptr
type(elpa_impl_t), pointer :: obj
obj => elpa_impl_allocate(error)
ptr = c_loc(obj)
end function
#else
!c_no> #ifndef OPTIONAL_C_ERROR_ARGUMENT
!c_no> elpa_t elpa_allocate(int *error);
!c_no> #endif
function elpa_impl_allocate_c(error) result(ptr) bind(C, name="elpa_allocate")
integer(kind=c_int) :: error
type(c_ptr) :: ptr
type(elpa_impl_t), pointer :: obj
obj => elpa_impl_allocate(error)
ptr = c_loc(obj)
end function
#endif
#ifdef OPTIONAL_C_ERROR_ARGUMENT
!c_o> #ifdef OPTIONAL_C_ERROR_ARGUMENT
!c_o> #define NARGS(...) NARGS_(__VA_ARGS__, 5, 4, 3, 2, 1, 0)
!c_o> #define NARGS_(_5, _4, _3, _2, _1, N, ...) N
!c_o> #define CONC(A, B) CONC_(A, B)
!c_o> #define CONC_(A, B) A##B
!c_o> #define elpa_deallocate(...) CONC(elpa_deallocate, NARGS(__VA_ARGS__))(__VA_ARGS__)
!c_o> #endif
#endif
!c> /*! \brief C interface for the implementation of the elpa_deallocate method
!c> *
!c> * \param elpa_t handle of ELPA object to be deallocated
!c> * \param int* error code
!c> * \result void
!c> */
!c> void elpa_deallocate(elpa_t handle, int *error);
#ifdef OPTIONAL_C_ERROR_ARGUMENT
!c_o> #ifdef OPTIONAL_C_ERROR_ARGUMENT
!c_o> void elpa_deallocate2(elpa_t handle, int *error);
!c_o> void elpa_deallocate1(elpa_t handle);
!c_o> #endif
subroutine elpa_impl_deallocate_c2(handle, error) bind(C, name="elpa_deallocate2")
type(c_ptr), value :: handle
type(elpa_impl_t), pointer :: self
integer(kind=c_int) :: error
call c_f_pointer(handle, self)
call self%destroy(error)
deallocate(self)
end subroutine
subroutine elpa_impl_deallocate_c1(handle) bind(C, name="elpa_deallocate1")
type(c_ptr), value :: handle
type(elpa_impl_t), pointer :: self
call c_f_pointer(handle, self)
call self%destroy()
deallocate(self)
end subroutine
#else
!c_no> #ifndef OPTIONAL_C_ERROR_ARGUMENT
!c_no> void elpa_deallocate(elpa_t handle, int *error);
!c_no> #endif
subroutine elpa_impl_deallocate_c(handle, error) bind(C, name="elpa_deallocate")
type(c_ptr), value :: handle
type(elpa_impl_t), pointer :: self
......@@ -249,6 +312,8 @@ module elpa_impl
deallocate(self)
end subroutine
#endif
!> \brief function to load all the parameters, which have been saved to a file
!> Parameters
!> \param self class(elpa_impl_t) the allocated ELPA object
......@@ -387,13 +452,22 @@ module elpa_impl
#ifdef ENABLE_AUTOTUNING
#ifdef OPTIONAL_C_ERROR_ARGUMENT
!c_o> #ifdef OPTIONAL_C_ERROR_ARGUMENT
!c_o> #define elpa_autotune_deallocate(...) CONC(elpa_autotune_deallocate, NARGS(__VA_ARGS__))(__VA_ARGS__)
!c_o> #endif
#endif
!c> /*! \brief C interface for the implementation of the elpa_autotune_deallocate method
!c> *
!c> * \param elpa_autotune_impl_t handle of ELPA autotune object to be deallocated
!c> * \result void
!c> */
!c> void elpa_autotune_deallocate(elpa_autotune_t handle, int *error);
subroutine elpa_autotune_impl_deallocate_c( autotune_handle) bind(C, name="elpa_autotune_deallocate")
#ifdef OPTIONAL_C_ERROR_ARGUMENT
!c_o> #ifdef OPTIONAL_C_ERROR_ARGUMENT
!c_o> void elpa_autotune_deallocate2(elpa_autotune_t handle, int *error);
!c_o> void elpa_autotune_deallocate1(elpa_autotune_t handle);
!c_o> #endif
subroutine elpa_autotune_impl_deallocate_c1( autotune_handle) bind(C, name="elpa_autotune_deallocate1")
type(c_ptr), value :: autotune_handle
type(elpa_autotune_impl_t), pointer :: self
......@@ -402,7 +476,32 @@ module elpa_impl
call self%destroy()
deallocate(self)
end subroutine
subroutine elpa_autotune_impl_deallocate_c2( autotune_handle, error) bind(C, name="elpa_autotune_deallocate2")
type(c_ptr), value :: autotune_handle
type(elpa_autotune_impl_t), pointer :: self
integer(kind=c_int) :: error
call c_f_pointer(autotune_handle, self)
call self%destroy(error)
deallocate(self)
end subroutine
#else
!c_no> #ifndef OPTIONAL_C_ERROR_ARGUMENT
!c_no> void elpa_autotune_deallocate(elpa_autotune_t handle, int *error);
!c_no> #endif
subroutine elpa_autotune_impl_deallocate( autotune_handle, error) bind(C, name="elpa_autotune_deallocate")
type(c_ptr), value :: autotune_handle
type(elpa_autotune_impl_t), pointer :: self
integer(kind=c_int) :: error
call c_f_pointer(autotune_handle, self)
call self%destroy(error)
deallocate(self)
end subroutine
#endif
#endif /* ENABLE_AUTOTUNING */
!> \brief function to setup an ELPA object and to store the MPI communicators internally
!> Parameters
......
! This file is part of ELPA.
!
! The ELPA library was originally created by the ELPA consortium,
! consisting of the following organizations:
!
! - Max Planck Computing and Data Facility (MPCDF), formerly known as
! Rechenzentrum Garching der Max-Planck-Gesellschaft (RZG),
! - Bergische Universität Wuppertal, Lehrstuhl für angewandte
! Informatik,
! - Technische Universität München, Lehrstuhl für Informatik mit
! Schwerpunkt Wissenschaftliches Rechnen ,
! - Fritz-Haber-Institut, Berlin, Abt. Theorie,
! - Max-Plack-Institut für Mathematik in den Naturwissenschaften,
! Leipzig, Abt. Komplexe Strukutren in Biologie und Kognition,
! and
! - IBM Deutschland GmbH
!
!
! More information can be found here:
! http://elpa.mpcdf.mpg.de/
!
! ELPA is free software: you can redistribute it and/or modify
! it under the terms of the version 3 of the license of the
! GNU Lesser General Public License as published by the Free
! Software Foundation.
!
! ELPA is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU Lesser General Public License for more details.
!
! You should have received a copy of the GNU Lesser General Public License
! along with ELPA. If not, see <http://www.gnu.org/licenses/>
!
! ELPA reflects a substantial effort on the part of the original
! ELPA consortium, and we ask you to respect the spirit of the
! license that we chose: i.e., please contribute any changes you
! may have back to the original ELPA library distribution, and keep
! any derivatives of ELPA under the same license that we chose for
! the original distribution, the GNU Lesser General Public License.
!
! Author: Andreas Marek, MPCDF
#include "config-f90.h"
!> \brief Fortran module which exports the MPI functions to ELPA
module elpa_omp
#ifdef WITH_OPENMP
use omp_lib
#endif
use iso_c_binding
use precision
implicit none
public
integer(kind=ik) :: omp_threads_caller
end module
......@@ -199,7 +199,7 @@ int main(int argc, char** argv) {
}
handle = elpa_allocate(&error);
assert_elpa_ok(error);
//assert_elpa_ok(error);
/* Set parameters */
elpa_set(handle, "na", na, &error);
......
......@@ -174,8 +174,13 @@ int main(int argc, char** argv) {
exit(1);
}
#ifdef OPTIONAL_C_ERROR_ARGUMENT
handle = elpa_allocate();
#else
handle = elpa_allocate(&error);
assert_elpa_ok(error);
#endif
assert_elpa_ok(error);
/* Set parameters */
elpa_set(handle, "na", na, &error);
......@@ -285,8 +290,13 @@ int main(int argc, char** argv) {
elpa_autotune_print_best(handle, autotune_handle, &error);
}
#ifdef OPTIONAL_C_ERROR_ARGUMENT
elpa_autotune_deallocate(autotune_handle);
elpa_deallocate(handle);
#else
elpa_autotune_deallocate(autotune_handle, &error);
elpa_deallocate(handle, &error);
#endif
elpa_uninit(&error);
if (myid == 0) {
......
......@@ -230,8 +230,12 @@ int main(int argc, char** argv) {
MPI_Barrier(MPI_COMM_WORLD);
#endif
#ifdef OPTIONAL_C_ERROR_ARGUMENT
elpa_handle_2 = elpa_allocate();
#else
elpa_handle_2 = elpa_allocate(&error);
assert_elpa_ok(error);
#endif
set_basic_parameters(&elpa_handle_2, na, nev, na_rows, na_cols, nblk, my_prow, my_pcol);
/* Setup */
......@@ -341,7 +345,11 @@ int main(int argc, char** argv) {
elpa_autotune_deallocate(autotune_handle, &error);
elpa_deallocate(elpa_handle_1, &error);
#ifdef OPTIONAL_C_ERROR_ARGUMENT
elpa_deallocate(elpa_handle_2);
#else
elpa_deallocate(elpa_handle_2, &error);
#endif
elpa_uninit(&error);
if (myid == 0) {
......
......@@ -180,7 +180,7 @@ program test
do_test_hermitian_multiply
#ifdef WITH_OPENMP
integer :: max_threads
integer :: max_threads, threads_caller
#endif
#ifdef SPLIT_COMM_MYSELF
......@@ -532,6 +532,14 @@ program test
do_test_cholesky = .false.
endif