mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Clarified parameter help print and chosen OpenCL platform and device
This commit is contained in:
@@ -233,9 +233,9 @@ namespace Opm
|
||||
EWOMS_REGISTER_PARAM(TypeTag, int, CprReuseSetup, "Reuse Amg Setup");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, std::string, LinearSolverConfiguration, "Configuration of solver valid is: ilu0 (default), cpr_quasiimpes, cpr_trueimpes or file (specified in LinearSolverConfigurationJsonFile) ");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, std::string, LinearSolverConfigurationJsonFile, "Filename of JSON configuration for flexible linear solver system.");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, std::string, GpuMode, "Use GPU cusparseSolver or openclSolver as the linear solver");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, int, BdaDeviceId, "Choose device ID for cusparseSolver or openclSolver, too high value could lead to errors");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, int, OpenclPlatformId, "Choose platform ID for openclSolver, too high value could lead to errors");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, std::string, GpuMode, "Use GPU cusparseSolver or openclSolver as the linear solver, usage: '--gpu-mode=[none|cusparse|opencl]'");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, int, BdaDeviceId, "Choose device ID for cusparseSolver or openclSolver, use 'nvidia-smi' or 'clinfo' to determine valid IDs");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, int, OpenclPlatformId, "Choose platform ID for openclSolver, use 'clinfo' to determine valid platform IDs");
|
||||
}
|
||||
|
||||
FlowLinearSolverParameters() { reset(); }
|
||||
|
||||
@@ -345,7 +345,7 @@ void openclSolverBackend<block_size>::initialize(int N_, int nnz_, int dim, doub
|
||||
if (platforms.size() == 0) {
|
||||
OPM_THROW(std::logic_error, "Error openclSolver is selected but no OpenCL platforms are found");
|
||||
}
|
||||
out << "Found " << platforms.size() << " OpenCL platforms" << "\n\n";
|
||||
out << "Found " << platforms.size() << " OpenCL platforms" << "\n";
|
||||
|
||||
if (verbosity >= 1) {
|
||||
std::string platform_info;
|
||||
@@ -368,6 +368,16 @@ void openclSolverBackend<block_size>::initialize(int N_, int nnz_, int dim, doub
|
||||
|
||||
if (platforms.size() <= platformID) {
|
||||
OPM_THROW(std::logic_error, "Error chosen too high OpenCL platform ID");
|
||||
} else {
|
||||
std::string platform_info;
|
||||
out << "Chosen:\n";
|
||||
platforms[platformID].getInfo(CL_PLATFORM_NAME, &platform_info);
|
||||
out << "Platform name : " << platform_info << "\n";
|
||||
platforms[platformID].getInfo(CL_PLATFORM_VERSION, &platform_info);
|
||||
out << "Platform version : " << platform_info << "\n";
|
||||
OpmLog::info(out.str());
|
||||
out.str("");
|
||||
out.clear();
|
||||
}
|
||||
|
||||
cl_context_properties properties[] = {CL_CONTEXT_PLATFORM, (cl_context_properties)(platforms[platformID])(), 0};
|
||||
@@ -377,7 +387,7 @@ void openclSolverBackend<block_size>::initialize(int N_, int nnz_, int dim, doub
|
||||
if (devices.size() == 0){
|
||||
OPM_THROW(std::logic_error, "Error openclSolver is selected but no OpenCL devices are found");
|
||||
}
|
||||
out << "Found " << devices.size() << " OpenCL devices" << "\n\n";
|
||||
out << "Found " << devices.size() << " OpenCL devices" << "\n";
|
||||
|
||||
if (verbosity >= 1) {
|
||||
for (unsigned int i = 0; i < devices.size(); ++i) {
|
||||
@@ -393,8 +403,6 @@ void openclSolverBackend<block_size>::initialize(int N_, int nnz_, int dim, doub
|
||||
out << "CL_DRIVER_VERSION : " << device_info << "\n";
|
||||
devices[i].getInfo(CL_DEVICE_BUILT_IN_KERNELS, &device_info);
|
||||
out << "CL_DEVICE_BUILT_IN_KERNELS: " << device_info << "\n";
|
||||
devices[i].getInfo(CL_DEVICE_VERSION, &device_info);
|
||||
out << "CL_DEVICE_VERSION : " << device_info << "\n";
|
||||
devices[i].getInfo(CL_DEVICE_PROFILE, &device_info);
|
||||
out << "CL_DEVICE_PROFILE : " << device_info << "\n";
|
||||
devices[i].getInfo(CL_DEVICE_OPENCL_C_VERSION, &device_info);
|
||||
@@ -434,9 +442,21 @@ void openclSolverBackend<block_size>::initialize(int N_, int nnz_, int dim, doub
|
||||
}
|
||||
}
|
||||
OpmLog::info(out.str());
|
||||
out.str("");
|
||||
out.clear();
|
||||
|
||||
if (devices.size() <= deviceID){
|
||||
OPM_THROW(std::logic_error, "Error chosen too high OpenCL device ID");
|
||||
} else {
|
||||
std::string device_info;
|
||||
out << "Chosen:\n";
|
||||
devices[deviceID].getInfo(CL_DEVICE_NAME, &device_info);
|
||||
out << "CL_DEVICE_NAME : " << device_info << "\n";
|
||||
devices[deviceID].getInfo(CL_DEVICE_VERSION, &device_info);
|
||||
out << "CL_DEVICE_VERSION : " << device_info << "\n";
|
||||
OpmLog::info(out.str());
|
||||
out.str("");
|
||||
out.clear();
|
||||
}
|
||||
|
||||
cl::Program::Sources source(1, std::make_pair(axpy_s, strlen(axpy_s))); // what does this '1' mean? cl::Program::Sources is of type 'std::vector<std::pair<const char*, long unsigned int> >'
|
||||
|
||||
Reference in New Issue
Block a user