Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
elpa
elpa
Commits
ebc9ed9b
Commit
ebc9ed9b
authored
Feb 26, 2021
by
Andreas Marek
Browse files
New keywords for GPU in ELPA index
- Rename keyword "gpu" -> "nvidia-gpu" - Add keyword "amd-gpu"
parent
22b86859
Changes
14
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Makefile.am
View file @
ebc9ed9b
...
...
@@ -139,7 +139,7 @@ libelpa@SUFFIX@_private_la_SOURCES += \
endif
if
WITH_NVIDIA_GPU_VERSION
libelpa@SUFFIX@
_private_la_SOURCES
+=
src/GPU/CUDA/elpa_index_gpu.cu src/GPU/CUDA/cudaFunctions.cu src/GPU/CUDA/cuUtils.cu src/elpa2/GPU/CUDA/ev_tridi_band_gpu_real.cu src/elpa2/GPU/CUDA/ev_tridi_band_gpu_complex.cu
libelpa@SUFFIX@
_private_la_SOURCES
+=
src/GPU/CUDA/elpa_index_
nvidia_
gpu.cu src/GPU/CUDA/cudaFunctions.cu src/GPU/CUDA/cuUtils.cu src/elpa2/GPU/CUDA/ev_tridi_band_gpu_real.cu src/elpa2/GPU/CUDA/ev_tridi_band_gpu_complex.cu
endif
if
WITH_AMD_GPU_VERSION
...
...
src/GPU/CUDA/elpa_index_gpu.cu
→
src/GPU/CUDA/elpa_index_
nvidia_
gpu.cu
View file @
ebc9ed9b
extern
"C"
{
int
gpu_count
()
{
int
nvidia_
gpu_count
()
{
int
count
;
cudaError_t
cuerr
=
cudaGetDeviceCount
(
&
count
);
if
(
cuerr
!=
cudaSuccess
)
{
...
...
src/elpa1/elpa1_template.F90
View file @
ebc9ed9b
...
...
@@ -294,7 +294,7 @@ function elpa_solve_evp_&
obj
%
eigenvalues_only
=
.true.
endif
call
obj
%
get
(
"gpu"
,
gpu
,
error
)
call
obj
%
get
(
"
nvidia-
gpu"
,
gpu
,
error
)
if
(
error
.ne.
ELPA_OK
)
then
print
*
,
"Problem getting option for gpu. Aborting..."
stop
...
...
src/elpa1/elpa_multiply_a_b.F90
View file @
ebc9ed9b
...
...
@@ -109,7 +109,7 @@
success
=
.true.
! GPU settings
call
obj
%
get
(
"gpu"
,
gpu
,
error
)
call
obj
%
get
(
"
nvidia-
gpu"
,
gpu
,
error
)
if
(
error
.ne.
ELPA_OK
)
then
print
*
,
"Problem getting option for gpu. Aborting..."
stop
...
...
src/elpa2/elpa2_template.F90
View file @
ebc9ed9b
...
...
@@ -365,7 +365,7 @@
wantDebug
=
debug
==
1
! GPU settings
call
obj
%
get
(
"gpu"
,
gpu
,
error
)
call
obj
%
get
(
"
nvidia-
gpu"
,
gpu
,
error
)
if
(
error
.ne.
ELPA_OK
)
then
print
*
,
"Problem getting option gpu settings. Aborting..."
stop
...
...
src/elpa_index.c
View file @
ebc9ed9b
...
...
@@ -113,7 +113,10 @@ static int min_tile_size_enumerate(elpa_index_t index, int i);
static
int
min_tile_size_is_valid
(
elpa_index_t
index
,
int
n
,
int
new_value
);
#ifdef WITH_NVIDIA_GPU_VERSION
int
gpu_count
();
int
nvidia_gpu_count
();
#endif
#ifdef WITH_AMD_GPU_VERSION
int
amd_gpu_count
();
#endif
static
int
use_gpu_id_cardinality
(
elpa_index_t
index
);
...
...
@@ -223,7 +226,9 @@ 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
),
\
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
),
INT_ENTRY
(
"gpu"
,
"Use 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
),
INT_ENTRY
(
"amd-gpu"
,
"Use AMD GPU acceleration"
,
0
,
ELPA_AUTOTUNE_MEDIUM
,
ELPA_AUTOTUNE_DOMAIN_ANY
,
\
cardinality_bool
,
enumerate_identity
,
gpu_is_valid
,
NULL
,
PRINT_YES
),
INT_ENTRY
(
"is_skewsymmetric"
,
"Matrix is skewsymmetic"
,
0
,
ELPA_AUTOTUNE_NOT_TUNABLE
,
0
,
cardinality_bool
,
enumerate_identity
,
skewsymmetric_is_valid
,
NULL
,
PRINT_YES
),
...
...
@@ -765,7 +770,7 @@ static int real_kernel_is_valid(elpa_index_t index, int n, int new_value) {
if
(
solver
==
ELPA_SOLVER_1STAGE
)
{
return
new_value
==
ELPA_2STAGE_REAL_DEFAULT
;
}
int
gpu_is_active
=
elpa_index_get_int_value
(
index
,
"gpu"
,
NULL
);
int
gpu_is_active
=
(
elpa_index_get_int_value
(
index
,
"
nvidia-
gpu"
,
NULL
)
||
elpa_index_get_int_value
(
index
,
"amd-gpu"
,
NULL
))
;
switch
(
new_value
)
{
ELPA_FOR_ALL_2STAGE_REAL_KERNELS
(
VALID_CASE_3
,
REAL_GPU_KERNEL_ONLY_WHEN_GPU_IS_ACTIVE
)
default:
...
...
@@ -804,7 +809,7 @@ static int complex_kernel_is_valid(elpa_index_t index, int n, int new_value) {
if
(
solver
==
ELPA_SOLVER_1STAGE
)
{
return
new_value
==
ELPA_2STAGE_COMPLEX_DEFAULT
;
}
int
gpu_is_active
=
elpa_index_get_int_value
(
index
,
"gpu"
,
NULL
);
int
gpu_is_active
=
(
elpa_index_get_int_value
(
index
,
"
nvidia-
gpu"
,
NULL
)
||
elpa_index_get_int_value
(
index
,
"amd-gpu"
,
NULL
))
;
switch
(
new_value
)
{
ELPA_FOR_ALL_2STAGE_COMPLEX_KERNELS
(
VALID_CASE_3
,
COMPLEX_GPU_KERNEL_ONLY_WHEN_GPU_IS_ACTIVE
)
default:
...
...
@@ -1038,7 +1043,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
)
{
int
gpu_is_active
=
elpa_index_get_int_value
(
index
,
"gpu"
,
NULL
);
int
gpu_is_active
=
(
elpa_index_get_int_value
(
index
,
"
nvidia-
gpu"
,
NULL
)
||
elpa_index_get_int_value
(
index
,
"amd-gpu"
,
NULL
))
;
if
(
gpu_is_active
==
1
)
{
return
((
new_value
==
0
)
||
(
new_value
==
1
));
}
...
...
@@ -1049,7 +1054,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
)
{
int
solver
=
elpa_index_get_int_value
(
index
,
"solver"
,
NULL
);
int
gpu_is_active
=
elpa_index_get_int_value
(
index
,
"gpu"
,
NULL
);
int
gpu_is_active
=
(
elpa_index_get_int_value
(
index
,
"
nvidia-
gpu"
,
NULL
)
||
elpa_index_get_int_value
(
index
,
"amd-gpu"
,
NULL
))
;
if
((
solver
==
ELPA_SOLVER_1STAGE
)
&&
(
gpu_is_active
==
1
))
{
return
((
new_value
==
0
)
||
(
new_value
==
1
));
}
...
...
@@ -1060,7 +1065,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
)
{
int
solver
=
elpa_index_get_int_value
(
index
,
"solver"
,
NULL
);
int
gpu_is_active
=
elpa_index_get_int_value
(
index
,
"gpu"
,
NULL
);
int
gpu_is_active
=
(
elpa_index_get_int_value
(
index
,
"
nvidia-
gpu"
,
NULL
)
||
elpa_index_get_int_value
(
index
,
"amd-gpu"
,
NULL
))
;
if
((
solver
==
ELPA_SOLVER_2STAGE
)
&&
(
gpu_is_active
==
1
))
{
return
((
new_value
==
0
)
||
(
new_value
==
1
));
}
...
...
@@ -1106,12 +1111,14 @@ static int max_stored_rows_is_valid(elpa_index_t index, int n, int new_value) {
static
int
use_gpu_id_cardinality
(
elpa_index_t
index
)
{
#ifdef WITH_NVIDIA_GPU_VERSION
int
count
;
count
=
gpu_count
();
count
=
nvidia_
gpu_count
();
if
(
count
==
-
1000
)
{
fprintf
(
stderr
,
"Querrying GPUs failed! Set GPU count = 0
\n
"
);
return
0
;
}
return
count
;
#elif WITH_AMD_GPU_VERION
return
0
;
#else
return
0
;
#endif
...
...
@@ -1125,13 +1132,15 @@ static int use_gpu_id_enumerate(elpa_index_t index, int i) {
static
int
use_gpu_id_is_valid
(
elpa_index_t
index
,
int
n
,
int
new_value
)
{
#ifdef WITH_NVIDIA_GPU_VERSION
int
count
;
count
=
gpu_count
();
count
=
nvidia_
gpu_count
();
if
(
count
==
-
1000
)
{
fprintf
(
stderr
,
"Querrying GPUs failed! Return with error
\n
"
);
return
0
==
1
;
}
else
{
return
(
0
<=
new_value
)
&&
(
new_value
<=
count
);
}
#elif WITH_AMD_GPU_VERION
return
0
==
1
;
#else
return
0
==
0
;
#endif
...
...
test/C/test.c
View file @
ebc9ed9b
...
...
@@ -273,7 +273,7 @@ int main(int argc, char** argv) {
#endif
assert_elpa_ok
(
error_elpa
);
elpa_set
(
handle
,
"gpu"
,
TEST_GPU
,
&
error_elpa
);
elpa_set
(
handle
,
"
nvidia-
gpu"
,
TEST_GPU
,
&
error_elpa
);
assert_elpa_ok
(
error_elpa
);
#if defined(TEST_SOLVE_2STAGE) && defined(TEST_KERNEL)
...
...
test/C/test_autotune.c
View file @
ebc9ed9b
...
...
@@ -226,7 +226,7 @@ int main(int argc, char** argv) {
/* Setup */
assert_elpa_ok
(
elpa_setup
(
handle
));
elpa_set
(
handle
,
"gpu"
,
0
,
&
error_elpa
);
elpa_set
(
handle
,
"
nvidia-
gpu"
,
0
,
&
error_elpa
);
assert_elpa_ok
(
error_elpa
);
autotune_handle
=
elpa_autotune_setup
(
handle
,
ELPA_AUTOTUNE_FAST
,
ELPA_AUTOTUNE_DOMAIN_REAL
,
&
error_elpa
);
...
...
test/C/test_multiple_objs.c
View file @
ebc9ed9b
...
...
@@ -223,7 +223,7 @@ int main(int argc, char** argv) {
/* Setup */
assert_elpa_ok
(
elpa_setup
(
elpa_handle_1
));
elpa_set
(
elpa_handle_1
,
"gpu"
,
0
,
&
error_elpa
);
elpa_set
(
elpa_handle_1
,
"
nvidia-
gpu"
,
0
,
&
error_elpa
);
assert_elpa_ok
(
error_elpa
);
elpa_set
(
elpa_handle_1
,
"timings"
,
1
,
&
error_elpa
);
...
...
@@ -253,7 +253,7 @@ int main(int argc, char** argv) {
elpa_load_settings
(
elpa_handle_2
,
"initial_parameters.txt"
,
&
error_elpa
);
elpa_get
(
elpa_handle_2
,
"gpu"
,
&
gpu
,
&
error_elpa
);
elpa_get
(
elpa_handle_2
,
"
nvidia-
gpu"
,
&
gpu
,
&
error_elpa
);
assert_elpa_ok
(
error_elpa
);
elpa_get
(
elpa_handle_2
,
"timings"
,
&
timings
,
&
error_elpa
);
...
...
test/Fortran/test.F90
View file @
ebc9ed9b
...
...
@@ -640,7 +640,7 @@ program test
#endif
assert_elpa_ok
(
error_elpa
)
call
e
%
set
(
"gpu"
,
TEST_GPU
,
error_elpa
)
call
e
%
set
(
"
nvidia-
gpu"
,
TEST_GPU
,
error_elpa
)
assert_elpa_ok
(
error_elpa
)
#ifdef TEST_GPU_SET_ID
...
...
test/Fortran/test_autotune.F90
View file @
ebc9ed9b
...
...
@@ -228,7 +228,7 @@ program test
call
e
%
set
(
"debug"
,
1
,
error_elpa
)
assert_elpa_ok
(
error_elpa
)
call
e
%
set
(
"gpu"
,
0
,
error_elpa
)
call
e
%
set
(
"
nvidia-
gpu"
,
0
,
error_elpa
)
assert_elpa_ok
(
error_elpa
)
!call e%set("max_stored_rows", 15, error_elpa)
...
...
test/Fortran/test_multiple_objs.F90
View file @
ebc9ed9b
...
...
@@ -209,7 +209,7 @@ program test
call
e1
%
set
(
"debug"
,
1
,
error_elpa
)
assert_elpa_ok
(
error_elpa
)
call
e1
%
set
(
"gpu"
,
0
,
error_elpa
)
call
e1
%
set
(
"
nvidia-
gpu"
,
0
,
error_elpa
)
assert_elpa_ok
(
error_elpa
)
!call e1%set("max_stored_rows", 15, error_elpa)
...
...
@@ -238,7 +238,7 @@ program test
assert_elpa_ok
(
error_elpa
)
call
e2
%
get
(
"debug"
,
int
(
debug
,
kind
=
c_int
),
error_elpa
)
assert_elpa_ok
(
error_elpa
)
call
e2
%
get
(
"gpu"
,
int
(
gpu
,
kind
=
c_int
),
error_elpa
)
call
e2
%
get
(
"
nvidia-
gpu"
,
int
(
gpu
,
kind
=
c_int
),
error_elpa
)
assert_elpa_ok
(
error_elpa
)
if
((
timings
.ne.
1
)
.or.
(
debug
.ne.
1
)
.or.
(
gpu
.ne.
0
))
then
...
...
test/Fortran/test_skewsymmetric.F90
View file @
ebc9ed9b
...
...
@@ -233,7 +233,7 @@ program test
call
e_complex
%
set
(
"timings"
,
1
,
error_elpa
)
call
e_complex
%
set
(
"debug"
,
1
,
error_elpa
)
call
e_complex
%
set
(
"gpu"
,
0
,
error_elpa
)
call
e_complex
%
set
(
"
nvidia-
gpu"
,
0
,
error_elpa
)
call
e_complex
%
set
(
"omp_threads"
,
8
,
error_elpa
)
assert_elpa_ok
(
e_complex
%
setup
())
...
...
@@ -271,7 +271,7 @@ program test
call
e_skewsymmetric
%
set
(
"timings"
,
1
,
error_elpa
)
call
e_skewsymmetric
%
set
(
"debug"
,
1
,
error_elpa
)
call
e_skewsymmetric
%
set
(
"gpu"
,
0
,
error_elpa
)
call
e_skewsymmetric
%
set
(
"
nvidia-
gpu"
,
0
,
error_elpa
)
call
e_skewsymmetric
%
set
(
"omp_threads"
,
8
,
error_elpa
)
assert_elpa_ok
(
e_skewsymmetric
%
setup
())
...
...
test/Fortran/test_split_comm.F90
View file @
ebc9ed9b
...
...
@@ -264,7 +264,7 @@ program test
call
e
%
set
(
"timings"
,
1
,
error_elpa
)
call
e
%
set
(
"debug"
,
1
,
error_elpa
)
call
e
%
set
(
"gpu"
,
0
,
error_elpa
)
call
e
%
set
(
"
nvidia-
gpu"
,
0
,
error_elpa
)
!call e%set("max_stored_rows", 15, error_elpa)
assert_elpa_ok
(
e
%
setup
())
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment