diff --git a/Makefile b/Makefile index f71a95d..1779770 100644 --- a/Makefile +++ b/Makefile @@ -21,5 +21,6 @@ get-dakota-src: git submodule update --init packages/pecos && \ git submodule update --init packages/surfpack && \ git apply ../src_patches/dakota-src.patch && \ + git apply --whitespace=nowarn ../src_patches/adaptsampl_batch.patch && \ find . \( -name \*.cpp -o -name \*.hpp -o -name \*.c -o -name \*.h \) -exec \ sed -i -E -f ../src_patches/replace_old_macros_numpy.sed {} + diff --git a/src_patches/adaptsampl_batch.patch b/src_patches/adaptsampl_batch.patch new file mode 100644 index 0000000..ea14ca8 --- /dev/null +++ b/src_patches/adaptsampl_batch.patch @@ -0,0 +1,43 @@ +diff --git a/src/NonDAdaptiveSampling.cpp b/src/NonDAdaptiveSampling.cpp +index 5a43bdf31..3d22b7418 100644 +--- a/src/NonDAdaptiveSampling.cpp ++++ b/src/NonDAdaptiveSampling.cpp +@@ -298,14 +298,30 @@ namespace Dakota + // add new_X to the build points and append approximation + VariablesArray points_to_add; + IntResponseMap responses_to_add; +- for(int i = 0; i < new_Xs.size(); i++) +- { +- iteratedModel.continuous_variables(new_Xs[i]); +- iteratedModel.evaluate(); +- responses_to_add.insert(IntResponsePair(iteratedModel.evaluation_id(), +- iteratedModel.current_response())); +- points_to_add.push_back(iteratedModel.current_variables()); +- } ++ if (iteratedModel.asynch_flag()) ++ { ++ fout << "\nUsing async evaluation" << std::endl; ++ ++ for(int i = 0; i < new_Xs.size(); i++) ++ { ++ iteratedModel.continuous_variables(new_Xs[i]); ++ iteratedModel.evaluate_nowait(); ++ points_to_add.push_back(iteratedModel.current_variables()); ++ } ++ ++ // Wait for the responses. ++ responses_to_add = iteratedModel.synchronize(); ++ } ++ else { ++ for(int i = 0; i < new_Xs.size(); i++) ++ { ++ iteratedModel.continuous_variables(new_Xs[i]); ++ iteratedModel.evaluate(); ++ responses_to_add.insert(IntResponsePair(iteratedModel.evaluation_id(), ++ iteratedModel.current_response())); ++ points_to_add.push_back(iteratedModel.current_variables()); ++ } ++ } + + gpModel.append_approximation(points_to_add,responses_to_add, true); +