Commit d3307a3b authored by Uldis Locans's avatar Uldis Locans
Browse files

ignore --use-dks flag in case no GPU is available on the system

parent f7d9b4ad
......@@ -87,7 +87,7 @@ IF (ENABLE_DKS)
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lcudart -lcufft -lcublas -lnvToolsExt -DDKS_CUDA")
### if any accelerator enabled set flag to use DKS ###
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIPPL_DKS -DOPAL_DKS")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIPPL_DKS -DIPPL_DKS_CUDA -DOPAL_DKS")
ENDIF (ENABLE_DKS)
### END DKS part ###
......
......@@ -78,7 +78,7 @@ IF (ENABLE_DKS)
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lcudart -lcufft -lcublas -lnvToolsExt -DDKS_CUDA")
### if any accelerator enabled set flag to use DKS ###
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIPPL_DKS -DOPAL_DKS")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIPPL_DKS -DIPPL_DKS_CUDA -DOPAL_DKS")
ENDIF (ENABLE_DKS)
### END DKS part ###
......
......@@ -337,9 +337,17 @@ IpplInfo::IpplInfo(int& argc, char**& argv, int removeargs, MPI_Comm mpicomm) {
} else if ( ( strcmp(argv[i], "--use-dks") == 0 ) ) {
// Set DKSEnabled to true if OPAL is compiled with DKS.
#ifdef IPPL_DKS
DKSEnabled = true;
INFOMSG("DKS enabled OPAL will use GPU where possible");
INFOMSG(endl);
int ndev = 0;
DKS->getDeviceCount(ndev);
if (ndev > 0) {
DKSEnabled = true;
INFOMSG("DKS enabled OPAL will use GPU where possible");
INFOMSG(endl);
} else {
DKSEnabled = false;
INFOMSG("No GPU device detected! --use-dks flag will have no effect");
INFOMSG(endl);
}
//TODO: check if any device is available and disable DKS if there isn't
#else
DKSEnabled = false;
......
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