Scheduled maintenance on Monday 2019-06-24 between 10:00-11:00 CEST

Commit 0894aaca authored by Andreas Marek's avatar Andreas Marek

Update documentation

parent 6e2bac26
...@@ -79,7 +79,12 @@ Fortran synopsis ...@@ -79,7 +79,12 @@ Fortran synopsis
print *, "ELPA API version not supported" print *, "ELPA API version not supported"
stop stop
endif endif
elpa => elpa_allocate() elpa => elpa_allocate(success)
if (success != ELPA_OK) then
! react on the error
! we urge every user to always check the error codes
! of all ELPA functions
endif
! set parameters decribing the matrix and it's MPI distribution ! set parameters decribing the matrix and it's MPI distribution
call elpa%set("na", na, success) ! size of the na x na matrix call elpa%set("na", na, success) ! size of the na x na matrix
...@@ -91,7 +96,7 @@ Fortran synopsis ...@@ -91,7 +96,7 @@ Fortran synopsis
call elpa%set("process_row", my_prow, success) ! row coordinate of MPI process call elpa%set("process_row", my_prow, success) ! row coordinate of MPI process
call elpa%set("process_col", my_pcol, success) ! column coordinate of MPI process call elpa%set("process_col", my_pcol, success) ! column coordinate of MPI process
succes = elpa%setup() success = elpa%setup()
! if desired, set any number of tunable run-time options ! if desired, set any number of tunable run-time options
! look at the list of possible options as detailed later in ! look at the list of possible options as detailed later in
...@@ -126,6 +131,11 @@ C Synopsis: ...@@ -126,6 +131,11 @@ C Synopsis:
} }
handle = elpa_allocate(&error); handle = elpa_allocate(&error);
if (error != ELPA_OK) {
/* react on the error code */
/* we urge the user to always check the error codes of all ELPA functions */
}
/* Set parameters the matrix and it's MPI distribution */ /* Set parameters the matrix and it's MPI distribution */
elpa_set(handle, "na", na, &error); // size of the na x na matrix elpa_set(handle, "na", na, &error); // size of the na x na matrix
...@@ -138,7 +148,7 @@ C Synopsis: ...@@ -138,7 +148,7 @@ C Synopsis:
elpa_set(handle, "process_col", my_pcol, &error); // column coordinate of MPI process elpa_set(handle, "process_col", my_pcol, &error); // column coordinate of MPI process
/* Setup */ /* Setup */
elpa_setup(handle); error = elpa_setup(handle);
/* if desired, set any number of tunable run-time options */ /* if desired, set any number of tunable run-time options */
/* look at the list of possible options as detailed later in /* look at the list of possible options as detailed later in
...@@ -284,7 +294,7 @@ Fortran synopsis ...@@ -284,7 +294,7 @@ Fortran synopsis
print *, "ELPA API version not supported" print *, "ELPA API version not supported"
stop stop
endif endif
elpa => elpa_allocate() elpa => elpa_allocate(success)
! set parameters decribing the matrix and it's MPI distribution ! set parameters decribing the matrix and it's MPI distribution
call elpa%set("na", na, success) call elpa%set("na", na, success)
...@@ -296,23 +306,23 @@ Fortran synopsis ...@@ -296,23 +306,23 @@ Fortran synopsis
call elpa%set("process_row", my_prow, success) call elpa%set("process_row", my_prow, success)
call elpa%set("process_col", my_pcol, success) call elpa%set("process_col", my_pcol, success)
succes = elpa%setup() success = elpa%setup()
tune_state => e%autotune_setup(ELPA_AUTOTUNE_MEDIUM, ELPA_AUTOTUNE_DOMAIN_REAL, error) ! prepare autotuning, set AUTOTUNE_LEVEL and the domain (real or complex) tune_state => e%autotune_setup(ELPA_AUTOTUNE_MEDIUM, ELPA_AUTOTUNE_DOMAIN_REAL, success) ! prepare autotuning, set AUTOTUNE_LEVEL and the domain (real or complex)
! do the loop of subsequent ELPA calls which will be used to do the autotuning ! do the loop of subsequent ELPA calls which will be used to do the autotuning
do i=1, scf_cycles do i=1, scf_cycles
unfinished = e%autotune_step(tune_state) ! check whether autotuning is finished; If not do next step unfinished = e%autotune_step(tune_state, success) ! check whether autotuning is finished; If not do next step
if (.not.(unfinished)) then if (.not.(unfinished)) then
print *,"autotuning finished at step ",i print *,"autotuning finished at step ",i
endif endif
call e%eigenvectors(a, ev, z, error) ! do the normal computation call e%eigenvectors(a, ev, z, success) ! do the normal computation
enddo enddo
call e%autotune_set_best(tune_state) ! from now use the values found by autotuning call e%autotune_set_best(tune_state, success) ! from now use the values found by autotuning
call elpa_autotune_deallocate(tune_state) ! cleanup autotuning object call elpa_autotune_deallocate(tune_state) ! cleanup autotuning object
``` ```
...@@ -350,7 +360,7 @@ C Synopsis ...@@ -350,7 +360,7 @@ C Synopsis
// repeatedl call ELPA, e.g. in an scf iteration // repeatedl call ELPA, e.g. in an scf iteration
for (i=0; i < scf_cycles; i++) { for (i=0; i < scf_cycles; i++) {
unfinished = elpa_autotune_step(handle, autotune_handle); // check whether autotuning finished. If not do next step unfinished = elpa_autotune_step(handle, autotune_handle, &error); // check whether autotuning finished. If not do next step
if (unfinished == 0) { if (unfinished == 0) {
printf("ELPA autotuning finished in the %d th scf step \n",i); printf("ELPA autotuning finished in the %d th scf step \n",i);
...@@ -360,7 +370,7 @@ C Synopsis ...@@ -360,7 +370,7 @@ C Synopsis
/* do the normal computation */ /* do the normal computation */
elpa_eigenvectors(handle, a, ev, z, &error); elpa_eigenvectors(handle, a, ev, z, &error);
} }
elpa_autotune_set_best(handle, autotune_handle); // from now on use values used by autotuning elpa_autotune_set_best(handle, autotune_handle &error); // from now on use values used by autotuning
elpa_autotune_deallocate(autotune_handle); // cleanup autotuning elpa_autotune_deallocate(autotune_handle); // cleanup autotuning
``` ```
......
...@@ -109,16 +109,29 @@ ...@@ -109,16 +109,29 @@
!> class(elpa_t), pointer :: elpa !> class(elpa_t), pointer :: elpa
!> integer :: success !> integer :: success
!> !>
!> ! We urge the user to always check the error code of all ELPA functions
!>
!> if (elpa_init(20181112) /= ELPA_OK) then !> if (elpa_init(20181112) /= ELPA_OK) then
!> print *, "ELPA API version not supported" !> print *, "ELPA API version not supported"
!> stop !> stop
!> endif !> endif
!> elpa => elpa_allocate() !> elpa => elpa_allocate(success)
!> if (success != ELPA_OK) then
!> print *,"Could not allocate ELPA"
!> endif
!> !>
!> ! set parameters decribing the matrix and it's MPI distribution !> ! set parameters decribing the matrix and it's MPI distribution
!> call elpa%set("na", na, success) !> call elpa%set("na", na, success, success)
!> call elpa%set("nev", nev, success) !> if (success != ELPA_OK) then
!> print *,"Could not set entry"
!> endif
!> call elpa%set("nev", nev, success, success)
!> ! check success code ...
!>
!> call elpa%set("local_nrows", na_rows, success) !> call elpa%set("local_nrows", na_rows, success)
!> ! check success code ...
!>
!> call elpa%set("local_ncols", na_cols, success) !> call elpa%set("local_ncols", na_cols, success)
!> call elpa%set("nblk", nblk, success) !> call elpa%set("nblk", nblk, success)
!> call elpa%set("mpi_comm_parent", MPI_COMM_WORLD, success) !> call elpa%set("mpi_comm_parent", MPI_COMM_WORLD, success)
...@@ -126,7 +139,10 @@ ...@@ -126,7 +139,10 @@
!> call elpa%set("process_col", my_pcol, success) !> call elpa%set("process_col", my_pcol, success)
!> !>
!> ! set up the elpa object !> ! set up the elpa object
!> succes = elpa%setup() !> success = elpa%setup()
!> if (succes != ELPA_OK) then
!> print *,"Could not setup ELPA object"
!> endif
!> !>
!> ! if desired, set tunable run-time options !> ! if desired, set tunable run-time options
!> ! here we want to use the 2-stage solver !> ! here we want to use the 2-stage solver
...@@ -139,7 +155,7 @@ ...@@ -139,7 +155,7 @@
!> \code{.f90} !> \code{.f90}
!> !>
!> ! if wanted you can store the settings and load them in another program !> ! if wanted you can store the settings and load them in another program
!> call elpa%store_settings("save_to_disk.txt") !> call elpa%store_settings("save_to_disk.txt", success)
!> !>
!> ! use method solve to solve the eigenvalue problem to obtain eigenvalues !> ! use method solve to solve the eigenvalue problem to obtain eigenvalues
!> ! and eigenvectors !> ! and eigenvectors
...@@ -161,6 +177,8 @@ ...@@ -161,6 +177,8 @@
!> elpa_t handle; !> elpa_t handle;
!> int error; !> int error;
!> !>
!> /* We urge the user to always check the error code of all ELPA functions */
!>
!> if (elpa_init(20181113) != ELPA_OK) { !> if (elpa_init(20181113) != ELPA_OK) {
!> fprintf(stderr, "Error: ELPA API version not supported"); !> fprintf(stderr, "Error: ELPA API version not supported");
!> exit(1); !> exit(1);
...@@ -168,6 +186,9 @@ ...@@ -168,6 +186,9 @@
!> !>
!> !>
!> handle = elpa_allocate(&error); !> handle = elpa_allocate(&error);
!> if (error != ELPA_OK) {
!> /* do sth. */
!> }
!> !>
!> /* Set parameters the matrix and it's MPI distribution */ !> /* Set parameters the matrix and it's MPI distribution */
!> elpa_set(handle, "na", na, &error); !> elpa_set(handle, "na", na, &error);
...@@ -180,7 +201,7 @@ ...@@ -180,7 +201,7 @@
!> elpa_set(handle, "process_col", my_pcol, &error); !> elpa_set(handle, "process_col", my_pcol, &error);
!> !>
!> /* Setup */ !> /* Setup */
!> elpa_setup(handle); !> error = elpa_setup(handle);
!> !>
!> /* if desired, set tunable run-time options */ !> /* if desired, set tunable run-time options */
!> /* here we want to use the 2-stage solver */ !> /* here we want to use the 2-stage solver */
...@@ -217,7 +238,7 @@ ...@@ -217,7 +238,7 @@
!> print *, "ELPA API version not supported" !> print *, "ELPA API version not supported"
!> stop !> stop
!> endif !> endif
!> elpa => elpa_allocate() !> elpa => elpa_allocate(success)
!> !>
!> ! set parameters decribing the matrix and it's MPI distribution !> ! set parameters decribing the matrix and it's MPI distribution
!> call elpa%set("na", na, success) !> call elpa%set("na", na, success)
...@@ -230,10 +251,10 @@ ...@@ -230,10 +251,10 @@
!> call elpa%set("process_col", my_pcol, success) !> call elpa%set("process_col", my_pcol, success)
!> !>
!> ! set up the elpa object !> ! set up the elpa object
!> succes = elpa%setup() !> success = elpa%setup()
!> !>
!> ! create autotune object !> ! create autotune object
!> tune_state => elpa%autotune_setup(ELPA_AUTOTUNE_FAST, ELPA_AUTOTUNE_DOMAIN_REAL, error) !> tune_state => elpa%autotune_setup(ELPA_AUTOTUNE_FAST, ELPA_AUTOTUNE_DOMAIN_REAL, success)
!> !>
!> ! you can set some options, these will be then FIXED for the autotuning step !> ! you can set some options, these will be then FIXED for the autotuning step
!> ! if desired, set tunable run-time options !> ! if desired, set tunable run-time options
...@@ -241,29 +262,29 @@ ...@@ -241,29 +262,29 @@
!> call e%set("solver", ELPA_SOLVER_2STAGE, success) !> call e%set("solver", ELPA_SOLVER_2STAGE, success)
!> !>
!> ! and set a specific kernel (must be supported on the machine) !> ! and set a specific kernel (must be supported on the machine)
!> call e%set("real_kernel", ELPA_2STAGE_REAL_AVX_BLOCK2) !> call e%set("real_kernel", ELPA_2STAGE_REAL_AVX_BLOCK2, success)
!> \endcode !> \endcode
!> ... set and get all other options that are desired !> ... set and get all other options that are desired
!> \code{.f90} !> \code{.f90}
!> !>
!> iter = 0 !> iter = 0
!> do while (elpa%autotune_step(tune_state)) !> do while (elpa%autotune_step(tune_state, success))
!> iter = iter + 1 !> iter = iter + 1
!> call e%eigenvectors(a, ev, z, success) !> call e%eigenvectors(a, ev, z, success)
!> !>
!> ! if needed you can save the autotune state at any point !> ! if needed you can save the autotune state at any point
!> ! and resume it !> ! and resume it
!> if (iter > MAX_ITER) then !> if (iter > MAX_ITER) then
!> call elpa%autotune_save_state(tune_state,"autotune_checkpoint.txt") !> call elpa%autotune_save_state(tune_state,"autotune_checkpoint.txt", success)
!> exit !> exit
!> endif !> endif
!> enddo !> enddo
!> !>
!> !set and print the finished autotuning !> !set and print the finished autotuning
!> call elpa%autotune_set_best(tune_state) !> call elpa%autotune_set_best(tune_state, success)
!> !>
!> ! store _TUNED_ ELPA object, if needed !> ! store _TUNED_ ELPA object, if needed
!> call elpa%store("autotuned_object.txt") !> call elpa%store("autotuned_object.txt", success)
!> !>
!> !deallocate autotune object !> !deallocate autotune object
!> call elpa_autotune_deallocate(tune_state) !> call elpa_autotune_deallocate(tune_state)
......
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