Commit f769bebc authored by Andreas Marek's avatar Andreas Marek

Add error return parameter for autotune functions

parent 3784b538
#pragma once #pragma once
#if 0
/*! \brief generic C method for elpa_autotune_print_best
*
* \param elpa_t handle: of the ELPA object which should be tuned
* \param elpa_autotune_t autotune_handle: the autotuning object
* \result none
*/
#define elpa_autotune_print_best(X) _Generic((X), elpa_autotune_print_best_no_err, \
elpa_autotune_print_best_err)(X)
/*! \brief generic C method for elpa_autotune_set_best
*
* \param elpa_t handle: of the ELPA object which should be tuned
* \param elpa_autotune_t autotune_handle: the autotuning object
* \param error int *
* \result none
*/
#define elpa_autotune_set_best(X) _Generic((X), elpa_autotune_set_best_no_err, \
elpa_autotune_set_best_err)(X)
/*! \brief generic C method for elpa_autotune_step
*
* \param elpa_t handle: of the ELPA object which should be tuned
* \param elpa_autotune_t autotune_handle: the autotuning object
* \param error int *error code
* \result int unfinished: describes whether autotuning finished (0) or not (1)
*/
#define elpa_autotune_step(X) _Generic((X), elpa_autotune_step_no_err, \
elpa_autotune_step_err)(X)
#endif
#if 0
/*! \brief generic C method for elpa_autotune_print_best
*
* \param elpa_t handle: of the ELPA object which should be tuned
* \param elpa_autotune_t autotune_handle: the autotuning object
* \result none
*/
#define elpa_autotune_print_best(...) OVERLOAD(elpa_autotune_print_best (__VA_ARGS__), \
(elpa_autotune_print_best_no_err (elpa_t, elpa_autotune_t)), \
(elpa_autotune_print_best_err (elpa_t, elpa_autotune_t, int*)), \
)
/*! \brief generic C method for elpa_autotune_set_best
*
* \param elpa_t handle: of the ELPA object which should be tuned
* \param elpa_autotune_t autotune_handle: the autotuning object
* \param error int *
* \result none
*/
#define elpa_autotune_set_best(...) OVERLOAD(elpa_autotune_set_best (__VA_ARGS__), \
(elpa_autotune_set_best_no_err (elpa_t, elpa_autotune_t)), \
(elpa_autotune_set_best_err (elpa_t, elpa_autotune_t, int*)), \
)
/*! \brief generic C method for elpa_autotune_step
*
* \param elpa_t handle: of the ELPA object which should be tuned
* \param elpa_autotune_t autotune_handle: the autotuning object
* \param error int *error code
* \result int unfinished: describes whether autotuning finished (0) or not (1)
*/
#define elpa_autotune_step(...) OVERLOAD(elpa_autotune_step (__VA_ARGS__), \
(elpa_autotune_step_no_err (elpa_t, elpa_autotune_t)), \
(elpa_autotune_step_err (elpa_t, elpa_autotune_t, int*)), \
)
#endif
/*! \brief generic C method for elpa_set /*! \brief generic C method for elpa_set
* *
......
...@@ -325,13 +325,15 @@ module elpa_api ...@@ -325,13 +325,15 @@ module elpa_api
!> \param self class(elpa_t): the ELPA object, which should be tuned !> \param self class(elpa_t): the ELPA object, which should be tuned
!> \param tune_state class(elpa_autotune_t): the autotuning object !> \param tune_state class(elpa_autotune_t): the autotuning object
!> \param unfinished logical: state whether tuning is unfinished or not !> \param unfinished logical: state whether tuning is unfinished or not
!> \param error integer, optional
abstract interface abstract interface
function elpa_autotune_step_i(self, tune_state) result(unfinished) function elpa_autotune_step_i(self, tune_state, error) result(unfinished)
import elpa_t, elpa_autotune_t import elpa_t, elpa_autotune_t
implicit none implicit none
class(elpa_t), intent(inout) :: self class(elpa_t), intent(inout) :: self
class(elpa_autotune_t), intent(inout), target :: tune_state class(elpa_autotune_t), intent(inout), target :: tune_state
logical :: unfinished logical :: unfinished
integer, optional, intent(out) :: error
end function end function
end interface end interface
...@@ -341,13 +343,15 @@ module elpa_api ...@@ -341,13 +343,15 @@ module elpa_api
!> \details !> \details
!> \param self class(elpa_t): the ELPA object, which should be tuned !> \param self class(elpa_t): the ELPA object, which should be tuned
!> \param tune_state class(elpa_autotune_t): the autotuning object !> \param tune_state class(elpa_autotune_t): the autotuning object
!> \param error integer, optional
!> Sets the best combination of ELPA options !> Sets the best combination of ELPA options
abstract interface abstract interface
subroutine elpa_autotune_set_best_i(self, tune_state) subroutine elpa_autotune_set_best_i(self, tune_state, error)
import elpa_t, elpa_autotune_t import elpa_t, elpa_autotune_t
implicit none implicit none
class(elpa_t), intent(inout) :: self class(elpa_t), intent(inout) :: self
class(elpa_autotune_t), intent(in), target :: tune_state class(elpa_autotune_t), intent(in), target :: tune_state
integer, optional, intent(out) :: error
end subroutine end subroutine
end interface end interface
...@@ -357,13 +361,15 @@ module elpa_api ...@@ -357,13 +361,15 @@ module elpa_api
!> \details !> \details
!> \param self class(elpa_t): the ELPA object, which should be tuned !> \param self class(elpa_t): the ELPA object, which should be tuned
!> \param tune_state class(elpa_autotune_t): the autotuning object !> \param tune_state class(elpa_autotune_t): the autotuning object
!> \param error integer, optional
!> Prints the best combination of ELPA options !> Prints the best combination of ELPA options
abstract interface abstract interface
subroutine elpa_autotune_print_best_i(self, tune_state) subroutine elpa_autotune_print_best_i(self, tune_state, error)
import elpa_t, elpa_autotune_t import elpa_t, elpa_autotune_t
implicit none implicit none
class(elpa_t), intent(inout) :: self class(elpa_t), intent(inout) :: self
class(elpa_autotune_t), intent(in), target :: tune_state class(elpa_autotune_t), intent(in), target :: tune_state
integer, optional, intent(out) :: error
end subroutine end subroutine
end interface end interface
......
This diff is collapsed.
...@@ -219,7 +219,7 @@ int main(int argc, char** argv) { ...@@ -219,7 +219,7 @@ int main(int argc, char** argv) {
for (i=0; i < 20; i++) { for (i=0; i < 20; i++) {
unfinished = elpa_autotune_step(handle, autotune_handle); unfinished = elpa_autotune_step_err(handle, autotune_handle, &error);
if (unfinished == 0) { if (unfinished == 0) {
if (myid == 0) { if (myid == 0) {
...@@ -269,7 +269,7 @@ int main(int argc, char** argv) { ...@@ -269,7 +269,7 @@ int main(int argc, char** argv) {
} }
} }
elpa_autotune_set_best(handle, autotune_handle); elpa_autotune_set_best_no_err(handle, autotune_handle);
elpa_autotune_deallocate(autotune_handle); elpa_autotune_deallocate(autotune_handle);
elpa_deallocate(handle); elpa_deallocate(handle);
......
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