Commit 768db157 authored by Lorenz Huedepohl's avatar Lorenz Huedepohl

Some cleanup of the "time_evp*" entries

We decided not to provide this information via the key/value store, but
rather to use the ftimings module for that.

@loh will take care to implement ftimings in the new API
@amarek wants to port the legacy API so that the old global module
  variables still contain valid values
parent e5a3670c
......@@ -84,9 +84,10 @@ enum ELPA_COMPLEX_KERNELS {
X(ELPA_OK, 0) \
X(ELPA_ERROR, -1) \
X(ELPA_ERROR_ENTRY_NOT_FOUND, -2) \
X(ELPA_ERROR_INVALID_VALUE, -3) \
X(ELPA_ERROR_VALUE_ALREADY_SET, -4) \
X(ELPA_ERROR_NO_STRING_REPRESENTATION, -5)
X(ELPA_ERROR_ENTRY_INVALID_VALUE, -3) \
X(ELPA_ERROR_ENTRY_ALREADY_SET, -4) \
X(ELPA_ERROR_ENTRY_NO_STRING_REPRESENTATION, -5) \
X(ELPA_ERROR_ENTRY_READONLY, -6)
enum ELPA_ERRORS {
ELPA_FOR_ALL_ERRORS(ELPA_ENUM_ENTRY)
......
......@@ -59,8 +59,7 @@ function elpa_solve_evp_&
&_1stage_&
&PRECISION&
&_impl (obj, na, nev, a, lda, ev, q, ldq, nblk, matrixCols, mpi_comm_rows, &
mpi_comm_cols, mpi_comm_all, useGPU, time_evp_fwd, &
time_evp_solve, time_evp_back, summary_timings) result(success)
mpi_comm_cols, mpi_comm_all, useGPU) result(success)
use precision
use cuda_functions
use mod_check_for_gpu
......@@ -108,15 +107,11 @@ function elpa_solve_evp_&
logical, intent(in) :: useGPU
logical :: success
real(kind=c_double) :: time_evp_fwd, &
time_evp_solve, time_evp_back
logical, intent(in) :: summary_timings
logical :: do_useGPU
integer(kind=ik) :: numberOfGPUDevices
integer(kind=c_int) :: my_pe, n_pes, my_prow, my_pcol, mpierr
real(kind=C_DATATYPE_KIND), allocatable :: e(:)
real(kind=c_double) :: ttt0, ttt1 ! MPI_WTIME always needs double
logical :: wantDebug
integer(kind=c_int) :: istat
character(200) :: errorMessage
......@@ -210,19 +205,12 @@ function elpa_solve_evp_&
stop 1
endif
ttt0 = MPI_Wtime()
call tridiag_&
&MATH_DATATYPE&
&_&
&PRECISION&
& (na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, ev, e, tau, do_useGPU)
ttt1 = MPI_Wtime()
if(my_prow==0 .and. my_pcol==0 .and. summary_timings) write(error_unit,*) 'Time tridiag_real :',ttt1-ttt0
time_evp_fwd = ttt1-ttt0
ttt0 = MPI_Wtime()
call solve_tridi_&
&PRECISION&
& (na, nev, ev, e, &
......@@ -235,11 +223,6 @@ function elpa_solve_evp_&
nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug, success)
if (.not.(success)) return
ttt1 = MPI_Wtime()
if(my_prow==0 .and. my_pcol==0 .and. summary_timings) write(error_unit,*) 'Time solve_tridi :',ttt1-ttt0
time_evp_solve = ttt1-ttt0
ttt0 = MPI_Wtime()
#if COMPLEXCASE == 1
q(1:l_rows,1:l_cols_nev) = q_real(1:l_rows,1:l_cols_nev)
#endif
......@@ -249,9 +232,6 @@ function elpa_solve_evp_&
&_&
&PRECISION&
& (na, nev, a, lda, tau, q, ldq, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, do_useGPU)
ttt1 = MPI_Wtime()
if(my_prow==0 .and. my_pcol==0 .and. summary_timings) write(error_unit,*) 'Time trans_ev_real:',ttt1-ttt0
time_evp_back = ttt1-ttt0
#if COMPLEXCASE == 1
deallocate(q_real, stat=istat, errmsg=errorMessage)
......
......@@ -163,13 +163,11 @@ function elpa_solve_evp_&
endif
endif
if (elpa_print_times) then
call e%set("summary_timings", 1,successInternal)
if (successInternal .ne. ELPA_OK) then
print *, "Cannot set summary_timings"
success = .false.
return
endif
call e%set("summary_timings", 1,successInternal)
if (successInternal .ne. ELPA_OK) then
print *, "Cannot set summary_timings"
success = .false.
return
endif
call e%solve(a(1:lda,1:matrixCols), ev, q(1:ldq,1:matrixCols), successInternal)
......@@ -180,11 +178,10 @@ function elpa_solve_evp_&
return
endif
if (elpa_print_times) then
time_evp_fwd = e%get_double("time_evp_fwd")
time_evp_solve = e%get_double("time_evp_solve")
time_evp_back = e%get_double("time_evp_back")
endif
time_evp_fwd = e%get_double("time_evp_fwd")
time_evp_solve = e%get_double("time_evp_solve")
time_evp_back = e%get_double("time_evp_back")
call elpa_deallocate(e)
call elpa_uninit()
......
This diff is collapsed.
......@@ -109,7 +109,7 @@ module elpa2_impl
!> \param mpi_comm_cols MPI communicator for columns
!> \param mpi_comm_all MPI communicator for the total processor set
!>
!> \param THIS_REAL_ELPA_KERNEL_API (optional) specify used ELPA2 kernel via API
!> \param kernel specify ELPA2 kernel to use
!>
!> \param useQR (optional) use QR decomposition
!> \param useGPU (optional) decide whether to use GPUs or not
......@@ -157,7 +157,7 @@ module elpa2_impl
!> \param mpi_comm_cols MPI communicator for columns
!> \param mpi_comm_all MPI communicator for the total processor set
!>
!> \param THIS_REAL_ELPA_KERNEL_API (optional) specify used ELPA2 kernel via API
!> \param kernel specify ELPA2 kernel to use
!>
!> \param useQR (optional) use QR decomposition
!> \param useGPU (optional) decide whether GPUs should be used or not
......@@ -205,7 +205,7 @@ module elpa2_impl
!> \param mpi_comm_cols MPI communicator for columns
!> \param mpi_comm_all MPI communicator for the total processor set
!>
!> \param THIS_REAL_ELPA_KERNEL_API (optional) specify used ELPA2 kernel via API
!> \param kernel specify ELPA2 kernel to use
!> \param useGPU (optional) decide whether GPUs should be used or not
!>
!> \result success logical, false if error occured
......@@ -252,8 +252,8 @@ module elpa2_impl
!> \param mpi_comm_cols MPI communicator for columns
!> \param mpi_comm_all MPI communicator for the total processor set
!>
!> \param THIS_COMPLEX_ELPA_KERNEL_API (optional) specify used ELPA2 kernel via API
!> \param useGPU (optional) decide whether GPUs should be used or not
!> \param kernel specify ELPA2 kernel to use
!> \param useGPU (optional) decide whether GPUs should be used or not
!>
!> \result success logical, false if error occured
!-------------------------------------------------------------------------------
......
......@@ -55,7 +55,7 @@
&2stage_&
&PRECISION&
&_impl (obj, na, nev, a, lda, ev, q, ldq, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
time_evp_fwd, time_evp_solve, time_evp_back, summary_timings, useGPU, kernel &
useGPU, kernel &
#if REALCASE == 1
, useQR &
#endif
......@@ -106,10 +106,7 @@
#if COMPLEXCASE == 1
real(kind=C_DATATYPE_KIND), allocatable :: q_real(:,:)
#endif
real(kind=c_double) :: time_evp_fwd, time_evp_solve, time_evp_back
logical, intent(in) :: summary_timings
integer(kind=c_intptr_t) :: tmat_dev, q_dev, a_dev
real(kind=c_double) :: ttt0, ttt1, ttts ! MPI_WTIME always needs double
integer(kind=c_int) :: i
logical :: success, successCUDA
......@@ -225,8 +222,6 @@
success = .false.
return
endif
ttts = MPI_Wtime()
else
! Choose bandwidth, must be a multiple of nblk, set to a value >= 32
......@@ -257,9 +252,6 @@
endif
! Reduction full -> band
ttt0 = MPI_Wtime()
ttts = ttt0
call bandred_&
&MATH_DATATYPE&
&_&
......@@ -272,13 +264,6 @@
#endif
)
if (.not.(success)) return
ttt1 = MPI_Wtime()
if (my_prow==0 .and. my_pcol==0 .and. summary_timings) &
write(error_unit,*) "Time " // "bandred_&
&MATH_DATATYPE&
&_&
&PRECISION " // " :",ttt1-ttt0
end if ! matrix not already banded on input
! Reduction band -> tridiagonal
......@@ -292,29 +277,18 @@
stop 1
endif
ttt0 = MPI_Wtime()
call tridiag_band_&
&MATH_DATATYPE&
&_&
&PRECISION&
(na, nbw, nblk, a, a_dev, lda, ev, e, matrixCols, hh_trans, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, do_useGPU)
ttt1 = MPI_Wtime()
if (my_prow==0 .and. my_pcol==0 .and. summary_timings) &
write(error_unit,*) "Time " // "tridiag_band_&
&MATH_DATATYPE&
&_&
&PRECISION " // " :",ttt1-ttt0
#ifdef WITH_MPI
call timer%start("mpi_communication")
call mpi_bcast(ev, na, MPI_REAL_PRECISION, 0, mpi_comm_all, mpierr)
call mpi_bcast(e, na, MPI_REAL_PRECISION, 0, mpi_comm_all, mpierr)
call timer%stop("mpi_communication")
#endif /* WITH_MPI */
ttt1 = MPI_Wtime()
time_evp_fwd = ttt1-ttts
#if COMPLEXCASE == 1
l_rows = local_index(na, my_prow, np_rows, nblk, -1) ! Local rows of a and q
......@@ -331,8 +305,6 @@
#endif
! Solve tridiagonal system
ttt0 = MPI_Wtime()
call solve_tridi_&
&PRECISION &
(na, nev, ev, e, &
......@@ -346,12 +318,6 @@
if (.not.(success)) return
ttt1 = MPI_Wtime()
if (my_prow==0 .and. my_pcol==0 .and. summary_timings) &
write(error_unit,*) 'Time solve_tridi :',ttt1-ttt0
time_evp_solve = ttt1-ttt0
ttts = ttt1
deallocate(e, stat=istat, errmsg=errorMessage)
if (istat .ne. 0) then
print *,"solve_evp_&
......@@ -372,9 +338,6 @@
endif
#endif
! Backtransform stage 1
ttt0 = MPI_Wtime()
call trans_ev_tridi_to_band_&
&MATH_DATATYPE&
&_&
......@@ -382,15 +345,9 @@
(na, nev, nblk, nbw, q, &
q_dev, &
ldq, matrixCols, hh_trans, mpi_comm_rows, mpi_comm_cols, wantDebug, do_useGPU_trans_ev_tridi, &
summary_timings, success, kernel)
summary_timings=.false., success=success, kernel=kernel)
if (.not.(success)) return
ttt1 = MPI_Wtime()
if (my_prow==0 .and. my_pcol==0 .and. summary_timings) &
write(error_unit,*) "Time " // "trans_ev_tridi_to_band_&
&MATH_DATATYPE&
&_&
&PRECISION " // " :",ttt1-ttt0
! We can now deallocate the stored householder vectors
deallocate(hh_trans, stat=istat, errmsg=errorMessage)
......@@ -402,10 +359,7 @@
stop 1
endif
if( bandwidth .ne. -1) then
time_evp_back = ttt1-ttts
else
if( bandwidth == -1) then
if ( (do_useGPU) .and. .not.(do_useGPU_trans_ev_tridi) ) then
! copy to device if we want to continue on GPU
successCUDA = cuda_malloc(q_dev, ldq*matrixCols*size_of_datatype)
......@@ -414,7 +368,6 @@
endif
! Backtransform stage 2
ttt0 = MPI_Wtime()
call trans_ev_band_to_full_&
&MATH_DATATYPE&
&_&
......@@ -428,15 +381,6 @@
#endif
)
ttt1 = MPI_Wtime()
if (my_prow==0 .and. my_pcol==0 .and. summary_timings) &
write(error_unit,*) "Time " // "trans_ev_band_to_full_&
&MATH_DATATYPE&
&_&
&PRECISION " // " :",ttt1-ttt0
time_evp_back = ttt1-ttts
deallocate(tmat, stat=istat, errmsg=errorMessage)
if (istat .ne. 0) then
print *,"solve_evp_&
......
......@@ -198,13 +198,11 @@
endif
#endif
if (elpa_print_times) then
call e%set("summary_timings", 1,successInternal)
if (successInternal .ne. ELPA_OK) then
print *, "Cannot set summary_timings"
success = .false.
return
endif
call e%set("summary_timings", 1,successInternal)
if (successInternal .ne. ELPA_OK) then
print *, "Cannot set summary_timings"
success = .false.
return
endif
call e%solve(a(1:lda,1:matrixCols), ev, q(1:ldq,1:matrixCols), successInternal)
......@@ -214,11 +212,9 @@
return
endif
if (elpa_print_times) then
time_evp_fwd = e%get_double("time_evp_fwd")
time_evp_solve = e%get_double("time_evp_solve")
time_evp_back = e%get_double("time_evp_back")
endif
time_evp_fwd = e%get_double("time_evp_fwd")
time_evp_solve = e%get_double("time_evp_solve")
time_evp_back = e%get_double("time_evp_back")
call elpa_deallocate(e)
......
This diff is collapsed.
......@@ -140,9 +140,7 @@ static const elpa_index_int_entry_t int_entries[] = {
}
static const elpa_index_double_entry_t double_entries[] = {
READONLY_DOUBLE_ENTRY("time_evp_fwd", "Time for forward step [s]"),
READONLY_DOUBLE_ENTRY("time_evp_solve", "Time for solve step [s]"),
READONLY_DOUBLE_ENTRY("time_evp_back", "Time for back-substitution step [s]"),
/* Empty for now */
};
void elpa_index_free(elpa_index_t index) {
......@@ -235,8 +233,6 @@ FOR_ALL_TYPES(IMPLEMENT_GETENV)
} else { \
if (error != NULL) { \
*error = ELPA_ERROR_ENTRY_NOT_FOUND; \
} else { \
fprintf(stderr, "elpa_index_get_" #TYPE "(): No entry '%s' and you did not check for errors!\n", name); \
} \
return ERROR_VALUE; \
} \
......@@ -256,19 +252,22 @@ FOR_ALL_TYPES(IMPLEMENT_GET_FUNCTION)
FOR_ALL_TYPES(IMPLEMENT_LOC_FUNCTION)
#define IMPLEMENT_SET_FUNCTION(TYPE, ...) \
int elpa_index_set_##TYPE##_value(elpa_index_t index, char *name, TYPE value) { \
#define IMPLEMENT_SET_FUNCTION(TYPE, PRINTF_SPEC, ...) \
int elpa_index_set_##TYPE##_value(elpa_index_t index, char *name, TYPE value, int force_writable) { \
int n = find_##TYPE##_entry(name); \
if (n < 0) { \
return ELPA_ERROR_ENTRY_NOT_FOUND; \
}; \
if (TYPE##_entries[n].valid != NULL) { \
if(!TYPE##_entries[n].valid(index, n, value)) { \
return ELPA_ERROR_INVALID_VALUE; \
return ELPA_ERROR_ENTRY_INVALID_VALUE; \
}; \
} \
if (TYPE##_entries[n].base.once & index->TYPE##_options.is_set[n]) { \
return ELPA_ERROR_VALUE_ALREADY_SET; \
return ELPA_ERROR_ENTRY_ALREADY_SET; \
} \
if (TYPE##_entries[n].base.readonly & !force_writable) { \
return ELPA_ERROR_ENTRY_READONLY; \
} \
index->TYPE##_options.values[n] = value; \
index->TYPE##_options.is_set[n] = 1; \
......@@ -327,7 +326,7 @@ int elpa_int_value_to_string(char *name, int value, const char **string) {
return ELPA_ERROR_ENTRY_NOT_FOUND;
}
if (int_entries[n].to_string == NULL) {
return ELPA_ERROR_NO_STRING_REPRESENTATION;
return ELPA_ERROR_ENTRY_NO_STRING_REPRESENTATION;
}
*string = int_entries[n].to_string(value);
return ELPA_OK;
......@@ -351,7 +350,7 @@ int elpa_index_int_value_to_strlen(elpa_index_t index, char *name) {
if (n < 0) {
return 0;
}
return elpa_int_value_to_strlen(name, index->int_options.values[n]);
return elpa_int_value_to_strlen(name, index->int_options.values[n]);
}
......@@ -368,7 +367,7 @@ int elpa_int_string_to_value(char *name, char *string, int *value) {
*value = val;
return ELPA_OK;
} else {
return ELPA_ERROR_INVALID_VALUE;
return ELPA_ERROR_ENTRY_INVALID_VALUE;
}
}
......@@ -379,7 +378,7 @@ int elpa_int_string_to_value(char *name, char *string, int *value) {
return ELPA_OK;
}
}
return ELPA_ERROR_INVALID_VALUE;
return ELPA_ERROR_ENTRY_INVALID_VALUE;
}
int elpa_double_string_to_value(char *name, char *string, double *value) {
......@@ -391,12 +390,12 @@ int elpa_double_string_to_value(char *name, char *string, double *value) {
} else {
/* \todo: remove */
fprintf(stderr, "ELPA: DEBUG: Could not parse double value '%s' for option '%s'\n", string, name);
return ELPA_ERROR_INVALID_VALUE;
return ELPA_ERROR_ENTRY_INVALID_VALUE;
}
}
int elpa_double_value_to_string(char *name, double value, const char **string) {
return ELPA_ERROR_NO_STRING_REPRESENTATION;
return ELPA_ERROR_ENTRY_NO_STRING_REPRESENTATION;
}
int elpa_option_cardinality(char *name) {
......
......@@ -99,7 +99,8 @@ void elpa_index_free(elpa_index_t index);
/*
!f> interface
!f> function elpa_index_get_int_value_c(index, name, success) result(value) bind(C, name="elpa_index_get_int_value")
!f> function elpa_index_get_int_value_c(index, name, success) result(value) &
!f> bind(C, name="elpa_index_get_int_value")
!f> import c_ptr, c_int, c_char
!f> type(c_ptr), value :: index
!f> character(kind=c_char), intent(in) :: name(*)
......@@ -113,16 +114,18 @@ int elpa_index_get_int_value(elpa_index_t index, char *name, int *success);
/*
!f> interface
!f> function elpa_index_set_int_value_c(index, name, value) result(success) bind(C, name="elpa_index_set_int_value")
!f> function elpa_index_set_int_value_c(index, name, value, force_writable) result(success) &
!f> bind(C, name="elpa_index_set_int_value")
!f> import c_ptr, c_int, c_char
!f> type(c_ptr), value :: index
!f> character(kind=c_char), intent(in) :: name(*)
!f> integer(kind=c_int),intent(in), value :: value
!f> integer(kind=c_int),intent(in), value :: force_writable
!f> integer(kind=c_int) :: success
!f> end function
!f> end interface
*/
int elpa_index_set_int_value(elpa_index_t index, char *name, int value);
int elpa_index_set_int_value(elpa_index_t index, char *name, int value, int force_writable);
/*
......@@ -167,21 +170,24 @@ double elpa_index_get_double_value(elpa_index_t index, char *name, int *success)
/*
!f> interface
!f> function elpa_index_set_double_value_c(index, name, value) result(success) bind(C, name="elpa_index_set_double_value")
!f> function elpa_index_set_double_value_c(index, name, value, force_writable) result(success) &
!f> bind(C, name="elpa_index_set_double_value")
!f> import c_ptr, c_int, c_double, c_char
!f> type(c_ptr), value :: index
!f> character(kind=c_char), intent(in) :: name(*)
!f> real(kind=c_double),intent(in), value :: value
!f> integer(kind=c_int),intent(in), value :: force_writable
!f> integer(kind=c_int) :: success
!f> end function
!f> end interface
*/
int elpa_index_set_double_value(elpa_index_t index, char *name, double value);
int elpa_index_set_double_value(elpa_index_t index, char *name, double value, int force_writable);
/*
!f> interface
!f> function elpa_index_double_value_is_set_c(index, name) result(success) bind(C, name="elpa_index_double_value_is_set")
!f> function elpa_index_double_value_is_set_c(index, name) result(success) &
!f> bind(C, name="elpa_index_double_value_is_set")
!f> import c_ptr, c_int, c_char
!f> type(c_ptr), value :: index
!f> character(kind=c_char), intent(in) :: name(*)
......
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