Commit f8b7ddb9 authored by Andreas Marek's avatar Andreas Marek

Fix a newly introduced error in OpenMP code path

parent 6385071d
......@@ -438,7 +438,6 @@
#ifdef WITH_OPENMP
call obj%timer%start("OpenMP parallel" // PRECISION_SUFFIX)
! OPENMP_CHANGE here
!$OMP PARALLEL PRIVATE(i,my_thread,delta,s,info,j)
my_thread = omp_get_thread_num()
!$OMP DO
......
......@@ -62,6 +62,9 @@
&_impl
use elpa
use elpa_abstract_impl
#ifdef WITH_OPENMP
use omp_lib
#endif
implicit none
integer(kind=ik) :: na, nev, ldq, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols
real(kind=REAL_DATATYPE) :: d(na), e(na)
......@@ -75,6 +78,9 @@
logical :: success ! the return value
integer :: error
class(elpa_t), pointer :: obj
#ifdef WITH_OPENMP
integer :: nrThreads
#endif
!call timer%start("elpa_solve_tridi_&
!&PRECISION&
......@@ -132,6 +138,14 @@
return
endif
#ifdef WITH_OPENMP
nrThreads = omp_get_max_threads()
call obj%set("omp_threads", nrThreads, error)
#else
call obj%set("omp_threads", 1, error)
#endif
if (wantDebug) then
call obj%set("debug",1, error)
if (error .ne. ELPA_OK) then
......
......@@ -708,14 +708,12 @@ static int omp_threads_cardinality(elpa_index_t index) {
if (set_max_threads_glob == 0) {
max_threads_glob = omp_get_max_threads();
set_max_threads_glob = 1;
//printf("Setting global max threads to %d \n",max_threads_glob);
}
#else
max_threads_glob = 1;
set_max_threads_glob = 1;
#endif
max_threads = max_threads_glob;
//printf("Setting max threads to %d \n",max_threads);
return max_threads;
}
......@@ -726,11 +724,15 @@ static int omp_threads_enumerate(elpa_index_t index, int i) {
static int omp_threads_is_valid(elpa_index_t index, int n, int new_value) {
int max_threads;
#ifdef WITH_OPENMP
max_threads = max_threads_glob;
if (set_max_threads_glob == 0) {
max_threads_glob = omp_get_max_threads();
set_max_threads_glob = 1;
}
#else
max_threads = 1;
max_threads_glob = 1;
set_max_threads_glob = 1;
#endif
//printf("In valid max threads to %d \n",max_threads);
max_threads = max_threads_glob;
return (1 <= new_value) && (new_value <= max_threads);
}
......
......@@ -120,6 +120,9 @@ program test
#ifdef HAVE_REDIRECT
use test_redirect
#endif
#ifdef WITH_OPENMP
use omp_lib
#endif
implicit none
......@@ -176,6 +179,10 @@ program test
do_test_toeplitz_eigenvalues, do_test_cholesky, &
do_test_hermitian_multiply
#ifdef WITH_OPENMP
integer :: max_threads
#endif
call read_input_parameters_traditional(na, nev, nblk, write_to_file, skip_check_correctness)
call setup_mpi(myid, nprocs)
#ifdef HAVE_REDIRECT
......@@ -568,6 +575,12 @@ program test
assert_elpa_ok(error)
#endif
#ifdef WITH_OPENMP
max_threads=omp_get_max_threads()
call e%set("omp_threads", max_threads, error)
assert_elpa_ok(error)
#endif
if (myid == 0) print *, ""
#ifdef TEST_ALL_KERNELS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment