Commit e31aef46 authored by Andreas Marek's avatar Andreas Marek Committed by Lorenz Huedepohl
Browse files

Update legacy API to new interface [ci skip]

parent c3941607
...@@ -103,7 +103,7 @@ function elpa_solve_evp_& ...@@ -103,7 +103,7 @@ function elpa_solve_evp_&
integer(kind=c_int) :: successInternal integer(kind=c_int) :: successInternal
type(elpa_t) :: elpa1stage type(elpa_t) :: e
call timer%start("elpa_solve_evp_& call timer%start("elpa_solve_evp_&
&MATH_DATATYPE& &MATH_DATATYPE&
&_1stage_& &_1stage_&
...@@ -120,15 +120,26 @@ function elpa_solve_evp_& ...@@ -120,15 +120,26 @@ function elpa_solve_evp_&
return return
endif endif
elpa1stage = elpa_create(na, nev, lda, matrixCols, nblk, mpi_comm_all, & e = elpa_allocate()
my_prow, my_pcol, successInternal)
call e%set("na", na)
call e%set("local_nrows", lda)
call e%set("local_ncols", matrixCols)
call e%set("nblk", nblk)
call e%set("mpi_comm_parent", mpi_comm_all)
call e%set("process_row", my_prow)
call e%set("process_col", my_pcol)
call e%setup(successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot create elpa object" print *, "Cannot setup ELPA instance"
success = .false. success = .false.
return return
endif endif
call elpa1stage%set("solver", ELPA_SOLVER_1STAGE, successInternal) call e%set("solver", ELPA_SOLVER_1STAGE, successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot set ELPA 1stage solver" print *, "Cannot set ELPA 1stage solver"
success = .false. success = .false.
...@@ -137,14 +148,14 @@ function elpa_solve_evp_& ...@@ -137,14 +148,14 @@ function elpa_solve_evp_&
if (present(useGPU)) then if (present(useGPU)) then
if (useGPU) then if (useGPU) then
call elpa1stage%set("gpu", 1, successInternal) call e%set("gpu", 1, successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot set gpu" print *, "Cannot set gpu"
success = .false. success = .false.
return return
endif endif
else else
call elpa1stage%set("gpu", 0, successInternal) call e%set("gpu", 0, successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot set gpu" print *, "Cannot set gpu"
success = .false. success = .false.
...@@ -154,7 +165,7 @@ function elpa_solve_evp_& ...@@ -154,7 +165,7 @@ function elpa_solve_evp_&
endif endif
if (elpa_print_times) then if (elpa_print_times) then
call elpa1stage%set("summary_timings", 1,successInternal) call e%set("summary_timings", 1,successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot set summary_timings" print *, "Cannot set summary_timings"
success = .false. success = .false.
...@@ -162,7 +173,7 @@ function elpa_solve_evp_& ...@@ -162,7 +173,7 @@ function elpa_solve_evp_&
endif endif
endif endif
call elpa1stage%solve(a(1:lda,1:matrixCols), ev, q(1:ldq,1:matrixCols), successInternal) call e%solve(a(1:lda,1:matrixCols), ev, q(1:ldq,1:matrixCols), successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot solve with ELPA 1stage" print *, "Cannot solve with ELPA 1stage"
success = .false. success = .false.
...@@ -170,11 +181,11 @@ function elpa_solve_evp_& ...@@ -170,11 +181,11 @@ function elpa_solve_evp_&
endif endif
if (elpa_print_times) then if (elpa_print_times) then
time_evp_fwd = elpa1stage%time_evp_fwd time_evp_fwd = e%get("time_evp_fwd")
time_evp_solve = elpa1stage%time_evp_solve time_evp_solve = e%get("time_evp_solve")
time_evp_back = elpa1stage%time_evp_back time_evp_back = e%get("time_evp_back")
endif endif
call elpa1stage%destroy() call e%destroy()
call elpa_uninit() call elpa_uninit()
......
...@@ -119,13 +119,12 @@ ...@@ -119,13 +119,12 @@
call e%setup(successInternal) call e%setup(successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot create elpa object" print *, "Cannot setup ELPA instance"
success = .false. success = .false.
stop stop
return return
endif endif
call e%cholesky(a(1:lda,1:matrixCols), successInternal) call e%cholesky(a(1:lda,1:matrixCols), successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
......
...@@ -127,13 +127,12 @@ ...@@ -127,13 +127,12 @@
call e%setup(successInternal) call e%setup(successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot create elpa object" print *, "Cannot setup ELPA instance"
success = .false. success = .false.
stop stop
return return
endif endif
call e%invert_tridiagonal(a(1:lda,1:matrixCols), successInternal) call e%invert_tridiagonal(a(1:lda,1:matrixCols), successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
......
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
call e%setup(successInternal) call e%setup(successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot run multiply_a_b" print *, "Cannot setup ELPA instance"
stop stop
success = .false. success = .false.
return return
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
logical, intent(in) :: wantDebug logical, intent(in) :: wantDebug
logical :: success logical :: success
integer(kind=iK) :: successInternal integer(kind=iK) :: successInternal
type(elpa_t) :: elpaAPI type(elpa_t) :: e
call timer%start("elpa_solve_tridi_& call timer%start("elpa_solve_tridi_&
&PRECISION& &PRECISION&
...@@ -94,18 +94,25 @@ ...@@ -94,18 +94,25 @@
return return
endif endif
elpaAPI = elpa_create(na, nev, ldq, matrixCols, nblk, successInternal) e = elpa_allocate()
call e%set("na", na)
call e%set("local_nrows", lda)
call e%set("local_ncols", matrixCols)
call e%set("nblk", nblk)
call e%set("mpi_comm_rows", mpi_comm_rows)
call e%set("mpi_comm_cols", mpi_comm_cols)
call e%setup(successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot create elpa object" print *, "Cannot setup ELPA instance"
success = .false. success = .false.
stop stop
return return
endif endif
call elpaAPI%set_comm_rows(mpi_comm_rows) call e%solve_tridi(d(1:na), e(1:na), q(1:ldq,1:matrixCols), successInternal)
call elpaAPI%set_comm_cols(mpi_comm_cols)
call elpaAPI%solve_tridi(d(1:na), e(1:na), q(1:ldq,1:matrixCols), successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot run solve_tridi" print *, "Cannot run solve_tridi"
...@@ -115,7 +122,7 @@ ...@@ -115,7 +122,7 @@
else else
success =.true. success =.true.
endif endif
call elpaAPI%destroy() call e%destroy()
call elpa_uninit() call elpa_uninit()
......
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
logical :: success logical :: success
integer(kind=c_int) :: successInternal integer(kind=c_int) :: successInternal
type(elpa_t) :: elpa2stage type(elpa_t) :: e
call timer%start("solve_evp_& call timer%start("solve_evp_&
&MATH_DATATYPE& &MATH_DATATYPE&
...@@ -113,16 +113,26 @@ ...@@ -113,16 +113,26 @@
return return
endif endif
elpa2stage = elpa_create(na, nev, lda, matrixCols, nblk, mpi_comm_all, & e = elpa_allocate()
my_prow, my_pcol, successInternal)
call e%set("na", na)
call e%set("local_nrows", lda)
call e%set("local_ncols", matrixCols)
call e%set("nblk", nblk)
call e%set("mpi_comm_parent", mpi_comm_all)
call e%set("process_row", my_prow)
call e%set("process_col", my_pcol)
call e%setup(successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot create elpa object" print *, "Cannot setup ELPA instance"
success = .false. success = .false.
return return
endif endif
call elpa2stage%set("solver", ELPA_SOLVER_2STAGE, successInternal) call e%set("solver", ELPA_SOLVER_2STAGE, successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot set ELPA 1stage solver" print *, "Cannot set ELPA 1stage solver"
success = .false. success = .false.
...@@ -131,14 +141,14 @@ ...@@ -131,14 +141,14 @@
if (present(useGPU)) then if (present(useGPU)) then
if (useGPU) then if (useGPU) then
call elpa2stage%set("gpu", 1, successInternal) call e%set("gpu", 1, successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot set gpu" print *, "Cannot set gpu"
success = .false. success = .false.
return return
endif endif
else else
call elpa2stage%set("gpu", 0, successInternal) call e%set("gpu", 0, successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot set gpu" print *, "Cannot set gpu"
success = .false. success = .false.
...@@ -150,14 +160,14 @@ ...@@ -150,14 +160,14 @@
#if REALCASE == 1 #if REALCASE == 1
if (present(useQR)) then if (present(useQR)) then
if (useQR) then if (useQR) then
call elpa2stage%set("qr", 1, successInternal) call e%set("qr", 1, successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot set qr" print *, "Cannot set qr"
success = .false. success = .false.
return return
endif endif
else else
call elpa2stage%set("qr", 0, successInternal) call e%set("qr", 0, successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot set qr" print *, "Cannot set qr"
success = .false. success = .false.
...@@ -169,7 +179,7 @@ ...@@ -169,7 +179,7 @@
#if REALCASE == 1 #if REALCASE == 1
if (present(THIS_ELPA_KERNEL_API)) then if (present(THIS_ELPA_KERNEL_API)) then
call elpa2stage%set("real_kernel",THIS_ELPA_KERNEL_API, successInternal) call e%set("real_kernel",THIS_ELPA_KERNEL_API, successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot set ELPA2 stage real_kernel" print *, "Cannot set ELPA2 stage real_kernel"
success = .false. success = .false.
...@@ -180,7 +190,7 @@ ...@@ -180,7 +190,7 @@
#if COMPLEXCASE == 1 #if COMPLEXCASE == 1
if (present(THIS_ELPA_KERNEL_API)) then if (present(THIS_ELPA_KERNEL_API)) then
call elpa2stage%set("complex_kernel",THIS_ELPA_KERNEL_API, successInternal) call e%set("complex_kernel",THIS_ELPA_KERNEL_API, successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot set ELPA2 stage complex_kernel" print *, "Cannot set ELPA2 stage complex_kernel"
success = .false. success = .false.
...@@ -190,7 +200,7 @@ ...@@ -190,7 +200,7 @@
#endif #endif
if (elpa_print_times) then if (elpa_print_times) then
call elpa2stage%set("summary_timings", 1,successInternal) call e%set("summary_timings", 1,successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot set summary_timings" print *, "Cannot set summary_timings"
success = .false. success = .false.
...@@ -198,7 +208,7 @@ ...@@ -198,7 +208,7 @@
endif endif
endif endif
call elpa2stage%solve(a(1:lda,1:matrixCols), ev, q(1:ldq,1:matrixCols), successInternal) call e%solve(a(1:lda,1:matrixCols), ev, q(1:ldq,1:matrixCols), successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot solve with ELPA 2stage" print *, "Cannot solve with ELPA 2stage"
success = .false. success = .false.
...@@ -206,12 +216,12 @@ ...@@ -206,12 +216,12 @@
endif endif
if (elpa_print_times) then if (elpa_print_times) then
time_evp_fwd = elpa2stage%time_evp_fwd time_evp_fwd = e%get("time_evp_fwd")
time_evp_solve = elpa2stage%time_evp_solve time_evp_solve = e%get("time_evp_solve")
time_evp_back = elpa2stage%time_evp_back time_evp_back = e%get("time_evp_back")
endif endif
call elpa2stage%destroy() call e%destroy()
call elpa_uninit() call elpa_uninit()
......
Supports Markdown
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