Commit 7854c078 authored by Andreas Marek's avatar Andreas Marek
Browse files

Reintroduce keyword 'gpu' (for backwards compatibility) which got lost

parent d780eff4
...@@ -18,6 +18,9 @@ typedef struct elpa_autotune_struct *elpa_autotune_t; ...@@ -18,6 +18,9 @@ typedef struct elpa_autotune_struct *elpa_autotune_t;
#include <elpa/elpa_generated.h> #include <elpa/elpa_generated.h>
#include <elpa/elpa_generic.h> #include <elpa/elpa_generic.h>
#define ELPA_2STAGE_REAL_GPU ELPA_2STAGE_REAL_NVIDIA_GPU
#define ELPA_2STAGE_COMPLEX_GPU ELPA_2STAGE_COMPLEX_NVIDIA_GPU
const char *elpa_strerr(int elpa_error); const char *elpa_strerr(int elpa_error);
#endif #endif
...@@ -323,6 +323,20 @@ function elpa_solve_evp_& ...@@ -323,6 +323,20 @@ function elpa_solve_evp_&
endif endif
if (gpu_vendor() == NVIDIA_GPU) then if (gpu_vendor() == NVIDIA_GPU) then
call obj%get("gpu",gpu,error)
if (error .ne. ELPA_OK) then
print *,"Problem getting option for GPU. Aborting..."
stop
endif
if (gpu .eq. 1) then
print *,"You still use the deprecated option 'gpu', consider switching to 'nvidia-gpu'. Will set the new keyword &
& 'nvidia-gpu' now"
call obj%set("nvidia-gpu",gpu,error)
if (error .ne. ELPA_OK) then
print *,"Problem setting option for NVIDIA GPU. Aborting..."
stop
endif
endif
call obj%get("nvidia-gpu",gpu,error) call obj%get("nvidia-gpu",gpu,error)
if (error .ne. ELPA_OK) then if (error .ne. ELPA_OK) then
print *,"Problem getting option for NVIDIA GPU. Aborting..." print *,"Problem getting option for NVIDIA GPU. Aborting..."
......
...@@ -110,6 +110,21 @@ ...@@ -110,6 +110,21 @@
! GPU settings ! GPU settings
if (gpu_vendor() == NVIDIA_GPU) then if (gpu_vendor() == NVIDIA_GPU) then
call obj%get("gpu",gpu,error)
if (error .ne. ELPA_OK) then
print *,"Problem getting option for GPU. Aborting..."
stop
endif
if (gpu .eq. 1) then
print *,"You still use the deprecated option 'gpu', consider switching to 'nvidia-gpu'. Will set the new &
& keyword 'nvidia-gpu'"
call obj%set("nvidia-gpu",gpu,error)
if (error .ne. ELPA_OK) then
print *,"Problem setting option for NVIDIA GPU. Aborting..."
stop
endif
endif
call obj%get("nvidia-gpu",gpu,error) call obj%get("nvidia-gpu",gpu,error)
if (error .ne. ELPA_OK) then if (error .ne. ELPA_OK) then
print *,"Problem getting option for NVIDIA GPU. Aborting..." print *,"Problem getting option for NVIDIA GPU. Aborting..."
......
...@@ -414,6 +414,21 @@ ...@@ -414,6 +414,21 @@
! GPU settings ! GPU settings
if (gpu_vendor() == NVIDIA_GPU) then if (gpu_vendor() == NVIDIA_GPU) then
call obj%get("gpu",gpu,error)
if (error .ne. ELPA_OK) then
print *,"Problem getting option for GPU. Aborting..."
stop
endif
if (gpu .eq. 1) then
print *,"You still use the deprecated option 'gpu', consider switching to 'nvidia-gpu'. Will set the new keyword &
& 'nvidia-gpu' now"
call obj%set("nvidia-gpu",gpu,error)
if (error .ne. ELPA_OK) then
print *,"Problem setting option for NVIDIA GPU. Aborting..."
stop
endif
endif
call obj%get("nvidia-gpu",gpu,error) call obj%get("nvidia-gpu",gpu,error)
if (error .ne. ELPA_OK) then if (error .ne. ELPA_OK) then
print *,"Problem getting option for NVIDIA GPU. Aborting..." print *,"Problem getting option for NVIDIA GPU. Aborting..."
......
...@@ -53,4 +53,7 @@ module elpa_constants ...@@ -53,4 +53,7 @@ module elpa_constants
integer(kind=C_INT), parameter :: SC_DESC_LEN = 9 integer(kind=C_INT), parameter :: SC_DESC_LEN = 9
#include "src/fortran_constants.F90" #include "src/fortran_constants.F90"
integer(kind=C_INT), parameter :: ELPA_2STAGE_REAL_GPU = ELPA_2STAGE_REAL_NVIDIA_GPU
integer(kind=C_INT), parameter :: ELPA_2STAGE_COMPLEX_GPU = ELPA_2STAGE_COMPLEX_NVIDIA_GPU
end module end module
...@@ -233,6 +233,8 @@ static const elpa_index_int_entry_t int_entries[] = { ...@@ -233,6 +233,8 @@ static const elpa_index_int_entry_t int_entries[] = {
number_of_matrix_layouts, matrix_layout_enumerate, matrix_layout_is_valid, elpa_matrix_layout_name, PRINT_YES), \ number_of_matrix_layouts, matrix_layout_enumerate, matrix_layout_is_valid, elpa_matrix_layout_name, PRINT_YES), \
INT_ENTRY("solver", "Solver to use", ELPA_SOLVER_1STAGE, ELPA_AUTOTUNE_FAST, ELPA_AUTOTUNE_DOMAIN_ANY, \ INT_ENTRY("solver", "Solver to use", ELPA_SOLVER_1STAGE, ELPA_AUTOTUNE_FAST, ELPA_AUTOTUNE_DOMAIN_ANY, \
number_of_solvers, solver_enumerate, solver_is_valid, elpa_solver_name, PRINT_YES), number_of_solvers, solver_enumerate, solver_is_valid, elpa_solver_name, PRINT_YES),
INT_ENTRY("gpu", "Use Nvidia GPU acceleration", 0, ELPA_AUTOTUNE_MEDIUM, ELPA_AUTOTUNE_DOMAIN_ANY, \
cardinality_bool, enumerate_identity, gpu_is_valid, NULL, PRINT_YES),
INT_ENTRY("nvidia-gpu", "Use Nvidia GPU acceleration", 0, ELPA_AUTOTUNE_MEDIUM, ELPA_AUTOTUNE_DOMAIN_ANY, \ INT_ENTRY("nvidia-gpu", "Use Nvidia GPU acceleration", 0, ELPA_AUTOTUNE_MEDIUM, ELPA_AUTOTUNE_DOMAIN_ANY, \
cardinality_bool, enumerate_identity, gpu_is_valid, NULL, PRINT_YES), cardinality_bool, enumerate_identity, gpu_is_valid, NULL, PRINT_YES),
INT_ENTRY("intel-gpu", "Use INTEL GPU acceleration", 0, ELPA_AUTOTUNE_MEDIUM, ELPA_AUTOTUNE_DOMAIN_ANY, \ INT_ENTRY("intel-gpu", "Use INTEL GPU acceleration", 0, ELPA_AUTOTUNE_MEDIUM, ELPA_AUTOTUNE_DOMAIN_ANY, \
...@@ -787,7 +789,7 @@ static int real_kernel_is_valid(elpa_index_t index, int n, int new_value) { ...@@ -787,7 +789,7 @@ static int real_kernel_is_valid(elpa_index_t index, int n, int new_value) {
if (solver == ELPA_SOLVER_1STAGE) { if (solver == ELPA_SOLVER_1STAGE) {
return new_value == ELPA_2STAGE_REAL_DEFAULT; return new_value == ELPA_2STAGE_REAL_DEFAULT;
} }
int gpu_is_active = (elpa_index_get_int_value(index, "nvidia-gpu", NULL) || elpa_index_get_int_value(index, "amd-gpu", NULL) || elpa_index_get_int_value(index, "intel-gpu", NULL)); int gpu_is_active = (elpa_index_get_int_value(index, "nvidia-gpu", NULL) || elpa_index_get_int_value(index, "gpu", NULL) || elpa_index_get_int_value(index, "amd-gpu", NULL) || elpa_index_get_int_value(index, "intel-gpu", NULL));
switch(new_value) { switch(new_value) {
#ifdef WITH_NVIDIA_GPU_VERSION #ifdef WITH_NVIDIA_GPU_VERSION
ELPA_FOR_ALL_2STAGE_REAL_KERNELS(VALID_CASE_3, REAL_NVIDIA_GPU_KERNEL_ONLY_WHEN_GPU_IS_ACTIVE) ELPA_FOR_ALL_2STAGE_REAL_KERNELS(VALID_CASE_3, REAL_NVIDIA_GPU_KERNEL_ONLY_WHEN_GPU_IS_ACTIVE)
...@@ -1090,7 +1092,7 @@ static int omp_threads_is_valid(elpa_index_t index, int n, int new_value) { ...@@ -1090,7 +1092,7 @@ static int omp_threads_is_valid(elpa_index_t index, int n, int new_value) {
static int valid_with_gpu(elpa_index_t index, int n, int new_value) { static int valid_with_gpu(elpa_index_t index, int n, int new_value) {
int gpu_is_active = (elpa_index_get_int_value(index, "nvidia-gpu", NULL) || elpa_index_get_int_value(index, "amd-gpu", NULL) || elpa_index_get_int_value(index, "intel-gpu", NULL)); int gpu_is_active = (elpa_index_get_int_value(index, "nvidia-gpu", NULL) || elpa_index_get_int_value(index, "gpu", NULL) || elpa_index_get_int_value(index, "amd-gpu", NULL) || elpa_index_get_int_value(index, "intel-gpu", NULL));
if (gpu_is_active == 1) { if (gpu_is_active == 1) {
return ((new_value == 0 ) || (new_value == 1)); return ((new_value == 0 ) || (new_value == 1));
} }
...@@ -1101,7 +1103,7 @@ static int valid_with_gpu(elpa_index_t index, int n, int new_value) { ...@@ -1101,7 +1103,7 @@ static int valid_with_gpu(elpa_index_t index, int n, int new_value) {
static int valid_with_gpu_elpa1(elpa_index_t index, int n, int new_value) { static int valid_with_gpu_elpa1(elpa_index_t index, int n, int new_value) {
int solver = elpa_index_get_int_value(index, "solver", NULL); int solver = elpa_index_get_int_value(index, "solver", NULL);
int gpu_is_active = (elpa_index_get_int_value(index, "nvidia-gpu", NULL) || elpa_index_get_int_value(index, "amd-gpu", NULL) || elpa_index_get_int_value(index, "intel-gpu", NULL)); int gpu_is_active = (elpa_index_get_int_value(index, "nvidia-gpu", NULL) || elpa_index_get_int_value(index, "gpu", NULL) || elpa_index_get_int_value(index, "amd-gpu", NULL) || elpa_index_get_int_value(index, "intel-gpu", NULL));
if ((solver == ELPA_SOLVER_1STAGE) && (gpu_is_active == 1)) { if ((solver == ELPA_SOLVER_1STAGE) && (gpu_is_active == 1)) {
return ((new_value == 0 ) || (new_value == 1)); return ((new_value == 0 ) || (new_value == 1));
} }
...@@ -1112,7 +1114,7 @@ static int valid_with_gpu_elpa1(elpa_index_t index, int n, int new_value) { ...@@ -1112,7 +1114,7 @@ static int valid_with_gpu_elpa1(elpa_index_t index, int n, int new_value) {
static int valid_with_gpu_elpa2(elpa_index_t index, int n, int new_value) { static int valid_with_gpu_elpa2(elpa_index_t index, int n, int new_value) {
int solver = elpa_index_get_int_value(index, "solver", NULL); int solver = elpa_index_get_int_value(index, "solver", NULL);
int gpu_is_active = (elpa_index_get_int_value(index, "nvidia-gpu", NULL) || elpa_index_get_int_value(index, "amd-gpu", NULL) || elpa_index_get_int_value(index, "intel-gpu", NULL)); int gpu_is_active = (elpa_index_get_int_value(index, "nvidia-gpu", NULL) || elpa_index_get_int_value(index, "gpu", NULL) || elpa_index_get_int_value(index, "amd-gpu", NULL) || elpa_index_get_int_value(index, "intel-gpu", NULL));
if ((solver == ELPA_SOLVER_2STAGE) && (gpu_is_active == 1)) { if ((solver == ELPA_SOLVER_2STAGE) && (gpu_is_active == 1)) {
return ((new_value == 0 ) || (new_value == 1)); return ((new_value == 0 ) || (new_value == 1));
} }
......
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