Skip to content

Commit

Permalink
Allow hdf5 database to store all data and their predicate information
Browse files Browse the repository at this point in the history
* Fixes minor bug in switch-case statement of resource manger in case of device executions.
  • Loading branch information
koparasy authored Jun 17, 2024
1 parent 531534a commit 2ff2160
Show file tree
Hide file tree
Showing 12 changed files with 517 additions and 266 deletions.
18 changes: 18 additions & 0 deletions src/AMSlib/AMS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ struct AMSAbstractModel {
std::string SPath;
std::string UQPath;
std::string DBLabel;
bool DebugDB;
double threshold;
AMSUQPolicy uqPolicy;
int nClusters;
Expand Down Expand Up @@ -85,6 +86,15 @@ struct AMSAbstractModel {
return value["db_label"].get<std::string>();
}

bool parseDebugDB(nlohmann::json &value)
{
if (!value.contains("debug_db")) {
return false;
}

return value["debug_db"].get<bool>();
}


void parseUQPaths(AMSUQPolicy policy, nlohmann::json &jRoot)
{
Expand Down Expand Up @@ -189,6 +199,12 @@ struct AMSAbstractModel {
threshold = value["threshold"].get<float>();
parseUQPaths(uqPolicy, value);
DBLabel = parseDBLabel(value);
DebugDB = parseDebugDB(value);

CFATAL(AMS,
DebugDB && (SPath.empty()),
"To store predicates in dabase, a surrogate model field is "
"mandatory");
}


Expand All @@ -199,6 +215,7 @@ struct AMSAbstractModel {
double threshold,
int num_clusters)
{
DebugDB = false;
if (db_label == nullptr)
FATAL(AMS, "registering model without a database identifier\n");

Expand Down Expand Up @@ -550,6 +567,7 @@ ams::AMSWorkflow<FPTypeValue> *_AMSCreateExecutor(AMSCAbstrModel model,
model_descr.UQPath,
model_descr.SPath,
model_descr.DBLabel,
model_descr.DebugDB,
resource_type,
model_descr.threshold,
model_descr.uqPolicy,
Expand Down
9 changes: 7 additions & 2 deletions src/AMSlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@
file(GLOB_RECURSE MINIAPP_INCLUDES "*.hpp")
#set global library path to link with tests if necessary
set(LIBRARY_OUTPUT_PATH ${AMS_LIB_OUT_PATH})
set(AMS_LIB_SRC ${MINIAPP_INCLUDES} AMS.cpp wf/resource_manager.cpp wf/debug.cpp wf/basedb.cpp wf/logger.cpp)
set(AMS_LIB_SRC ${MINIAPP_INCLUDES} AMS.cpp wf/resource_manager.cpp wf/debug.cpp wf/basedb.cpp wf/logger.cpp wf/utils.cpp)

if (WITH_CUDA)
list(APPEND AMS_LIB_SRC wf/cuda/utilities.cpp)
message(WARNING "FILES ARE ${AMS_LIB_SRC}")
endif()

if (WITH_HDF5)
list(APPEND AMS_LIB_SRC wf/hdf5db.cpp)
endif()




# two targets: a shared lib and an exec
add_library(AMS ${AMS_LIB_SRC} ${MINIAPP_INCLUDES})
Expand Down
Loading

0 comments on commit 2ff2160

Please sign in to comment.