Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds -rp parameter and option to run ML model on GPU and physics module on CPU #43

Draft
wants to merge 18 commits into
base: develop
Choose a base branch
from

Conversation

alizalisan
Copy link

No description provided.

src/AMSlib/AMS.cpp Outdated Show resolved Hide resolved
src/AMSlib/wf/debug.h Outdated Show resolved Hide resolved
@@ -145,7 +145,7 @@ class ResourceManager
static void deallocate(std::vector<T*>& dPtr, AMSResourceType resource)
{
for (auto* I : dPtr)
RMAllocators[resource]->deallocate(I);
RMAllocators[resource]->deallocate(I, dev);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think over here you need to delete "dev".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

src/AMSlib/wf/workflow.hpp Outdated Show resolved Hide resolved
src/AMSlib/wf/workflow.hpp Outdated Show resolved Hide resolved
Comment on lines 226 to 244
// -------------------------------------------------------------
// STEP 1: call the hdcache to look at input uncertainties
// to decide if making a ML inference makes sense
// -------------------------------------------------------------
if (hdcache != nullptr) {
CALIPER(CALI_MARK_BEGIN("UQ_MODULE");)
hdcache->evaluate(totalElements, tmpInputs, p_ml_acceptable);
CALIPER(CALI_MARK_END("UQ_MODULE");)
}

DBG(Workflow, "Computed Predicates")

CALIPER(CALI_MARK_BEGIN("SURROGATE");)
// We need to call the model on all data values.
// Because we expect it to be faster.
// I guess we may need to add some policy to do this
DBG(Workflow, "Model exists, I am calling surrogate (for all data)");
surrogate->evaluate(totalElements, tmpInputs, tmpOutputs);
CALIPER(CALI_MARK_END("SURROGATE");)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Over here we call the model. Giorgis has changed the interfaces. Please study this commit here: 00589c2 . The commit replaces the 2 calls we had on both UQ and Model, with a single one that does both.

src/AMSlib/wf/workflow.hpp Outdated Show resolved Hide resolved
src/AMSlib/wf/workflow.hpp Outdated Show resolved Hide resolved
src/AMSlib/wf/workflow.hpp Outdated Show resolved Hide resolved
examples/main.cpp Outdated Show resolved Hide resolved
Copy link
Member

@koparasy koparasy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is shaping up nicely. I believe you need 2 small modification and you got it.

@alizalisan alizalisan changed the title Adds -rp options and option to run ML model on GPU and physics module on CPU Adds -rp parameter and option to run ML model on GPU and physics module on CPU Feb 1, 2024
if (phLoc != mlLoc) {
// Copy out the result
ResourceManager::copy(p_ml_acceptable, _p_ml_acceptable);
ResourceManager::deallocate(p_ml_acceptable, mlLoc);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You deallocate p_ml_acceptable here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants