Skip to content

Commit 5f7a9eb

Browse files
authored
fix: reject genelpa with GPU device (#7738)
1 parent 4a86b41 commit 5f7a9eb

4 files changed

Lines changed: 18 additions & 3 deletions

File tree

docs/advanced/input_files/input-main.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@
11601160
For numerical atomic orbitals basis,
11611161

11621162
- lapack: Use LAPACK to diagonalize the Hamiltonian, only used for serial version
1163-
- genelpa: Use GEN-ELPA to diagonalize the Hamiltonian.
1163+
- genelpa: Use the CPU-only GEN-ELPA interface to diagonalize the Hamiltonian.
11641164
- scalapack_gvx: Use Scalapack to diagonalize the Hamiltonian.
11651165
- cusolver: Use CUSOLVER to diagonalize the Hamiltonian, at least one GPU is needed.
11661166
- cusolvermp: Use CUSOLVER to diagonalize the Hamiltonian, supporting multi-GPU devices. Note that you should set the number of MPI processes equal to the number of GPUs.

docs/parameters.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ parameters:
540540
For numerical atomic orbitals basis,
541541
542542
* lapack: Use LAPACK to diagonalize the Hamiltonian, only used for serial version
543-
* genelpa: Use GEN-ELPA to diagonalize the Hamiltonian.
543+
* genelpa: Use the CPU-only GEN-ELPA interface to diagonalize the Hamiltonian.
544544
* scalapack_gvx: Use Scalapack to diagonalize the Hamiltonian.
545545
* cusolver: Use CUSOLVER to diagonalize the Hamiltonian, at least one GPU is needed.
546546
* cusolvermp: Use CUSOLVER to diagonalize the Hamiltonian, supporting multi-GPU devices. Note that you should set the number of MPI processes equal to the number of GPUs.

source/source_io/module_parameter/read_input_item_elec_stru.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ For plane-wave basis,
6060
For numerical atomic orbitals basis,
6161
6262
* lapack: Use LAPACK to diagonalize the Hamiltonian, only used for serial version
63-
* genelpa: Use GEN-ELPA to diagonalize the Hamiltonian.
63+
* genelpa: Use the CPU-only GEN-ELPA interface to diagonalize the Hamiltonian.
6464
* scalapack_gvx: Use Scalapack to diagonalize the Hamiltonian.
6565
* cusolver: Use CUSOLVER to diagonalize the Hamiltonian, at least one GPU is needed.
6666
* cusolvermp: Use CUSOLVER to diagonalize the Hamiltonian, supporting multi-GPU devices. Note that you should set the number of MPI processes equal to the number of GPUs.
@@ -164,6 +164,13 @@ Then the user has to correct the input file and restart the calculation.)";
164164
}
165165
else if (ks_solver == "genelpa")
166166
{
167+
if (para.input.device == "gpu")
168+
{
169+
ModuleBase::WARNING_QUIT(
170+
"ReadInput",
171+
"ks_solver = genelpa does not support GPU acceleration. "
172+
"Please use ks_solver = elpa with device = gpu.");
173+
}
167174
#ifndef __ELPA
168175
ModuleBase::WARNING_QUIT("Input",
169176
"Can not use genelpa if abacus is not compiled with "

source/source_io/test_serial/read_input_item_test.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,14 @@ TEST_F(InputTest, Item_test)
698698
param.input.device = "gpu";
699699
it->second.reset_value(it->second, param);
700700
EXPECT_EQ(param.input.ks_solver, "cusolver");
701+
702+
param.input.ks_solver = "genelpa";
703+
param.input.basis_type = "lcao";
704+
param.input.device = "gpu";
705+
testing::internal::CaptureStdout();
706+
EXPECT_EXIT(it->second.check_value(it->second, param), ::testing::ExitedWithCode(1), "");
707+
output = testing::internal::GetCapturedStdout();
708+
EXPECT_THAT(output, testing::HasSubstr("Please use ks_solver = elpa with device = gpu"));
701709
#ifdef __ELPA
702710
param.input.towannier90 = true;
703711
param.input.basis_type = "lcao_in_pw";

0 commit comments

Comments
 (0)