Commit 1554df90 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

meeting 28.10

parent 7a06c6fb
Pipeline #244365 passed with stages
in 30 minutes and 20 seconds
......@@ -11,8 +11,8 @@ set_option(USE_SPLITTED_COMMS ON)
set_option(AFFINE_LINEAR_TRAFO ON)
set_option(BUILD_TESTS OFF)
set_option(BUILD_TUTORIAL ON)
set_option(USE_UMBRIDGE OFF)
set_option(BUILD_MLUQ_TESTS ON)
set_sub_option(BUILD_TUTORIAL USE_UMBRIDGE OFF)
set_sub_option(BUILD_TUTORIAL BUILD_TUTORIAL_TESTS OFF)
#---------------------------------------------------------------------------------------#
......@@ -87,7 +87,7 @@ endif ()
if (USE_UMBRIDGE)
add_executable(Umbridge-M++ ${PROJECT_SOURCE_DIR}/mluq/src/MainUmbridge.cpp)
target_link_libraries(Umbridge-M++ TUTORIAL)
target_link_libraries(Umbridge-M++ ESTIMATORS)
endif ()
# Copy mppy to binary directory
......
#include "m++.hpp"
#include "main/EllipticMain.hpp"
#include "main/TransportMain.hpp"
#include "main/ReactionMain.hpp"
#include "main/AcousticMain.hpp"
#include "../../umbridge/lib/umbridge.h"
#include "UmbridgePDESolvers.hpp"
#ifdef COMPLEX
#error undef COMPLEX in src/Compiler.h
#endif
Main *ChooseMain(std::string model = "") {
if (model.empty()) config.get("Model", model);
if (model.find("Elliptic") != std::string::npos)
return new EllipticMain();
if (model.find("Transport") != std::string::npos)
return new TransportMain();
if (model.find("Reaction") != std::string::npos)
return new ReactionMain();
if (model.find("Acoustic") != std::string::npos)
return new AcousticMain();
Exit(model + " not found")
}
class MainForUmbridge : public EllipticMain, public umbridge::Model {
public:
MainForUmbridge() : umbridge::Model("forward") {}
// Define input and output dimensions of model (here we have a single vector of length 1 for input; same for output)
std::vector<std::size_t> GetInputSizes(const json &config_json) const override {
return {1};
}
std::vector<std::size_t> GetOutputSizes(const json &config_json) const override {
return {1};
}
// Define model evaluation; here we simply multiply the first input entry by two.
std::vector<std::vector<double>> Evaluate(const std::vector<std::vector<double>> &inputs,
json config_json) override {
// Todo
PPM->Broadcast(inputs[0][0]);
Vector u(0.0, GetDisc());
Run(u);
PrintValues(u);
return {{inputs[0][0] * 2.0}};
}
bool SupportsEvaluate() override {
return true;
}
};
int main(int argc, char **argv) {
Config::SetConfPath(std::string(ProjectMppDir) + "/tutorial/conf/");
Config::setConfigFileName("m++.conf");
Mpp::initialize(&argc, argv);
PDESolverConfig conf;
UmbridgeEllipticPDESolver pdeSolver(conf);
mout << "test" << endl;
MainForUmbridge main;
if (PPM->Master())
umbridge::serveModels({&main}, "0.0.0.0", 4242);
else
while (true)
main.Evaluate({{0.0}}, json());
// if (PPM->Master())
// umbridge::serveModels({&pdeSolver}, "0.0.0.0", 4242);
// else
// while (true)
// pdeSolver.Evaluate({{0.0}}, json());
return 0;
}
\ No newline at end of file
}
......@@ -9,4 +9,9 @@ add_library(ESTIMATORS STATIC
datastructure/WelfordAggregate.cpp
datastructure/LevelMaps.cpp
)
target_link_libraries(ESTIMATORS PDESOLVERS)
if (USE_UMBRIDGE)
target_link_libraries(ESTIMATORS UMBRIDGE_PDESOLVERS)
else ()
target_link_libraries(ESTIMATORS PDESOLVERS)
endif ()
......@@ -15,3 +15,9 @@ if (USE_SPACETIME)
target_link_libraries(PDESOLVERS PROBLEMS SPACETIME)
endif ()
if (USE_UMBRIDGE)
add_library(UMBRIDGE_PDESOLVERS STATIC
UmbridgePDESolvers.cpp
)
target_link_libraries(UMBRIDGE_PDESOLVERS PDESOLVERS)
endif()
\ No newline at end of file
//#include "UmbridgePDESolvers.hpp"
//
//umbridge::Model *CreateUmbridgePDESolver(PDESolverConfig conf) {
////#if USE_SPACETIME
//// if (conf.modelName.find("Acoustic") != std::string::npos)
//// return new STAcousticPDESolver(conf);
////#else
// if (conf.modelName.find("Elliptic") != std::string::npos)
// return new UmbridgeEllipticPDESolver(conf);
////
//// if (conf.modelName.find("Transport") != std::string::npos)
//// return new TransportPDESolver(conf);
////
//// if (conf.modelName.find("Reaction") != std::string::npos)
//// return new ReactionPDESolver(conf);
////
//// if (conf.modelName.find("Acoustic") != std::string::npos)
//// return new AcousticPDESolver(conf);
////#endif
//
// Exit(conf.modelName + " not found")
//}
//
//std::unique_ptr<umbridge::Model> CreateUmbridgePDESolverUnique(PDESolverConfig conf) {
// return std::unique_ptr<umbridge::Model>(CreateUmbridgePDESolver(conf));
//}
//
//std::shared_ptr<umbridge::Model> CreateUmbridgePDESolverShared(PDESolverConfig conf) {
// return std::shared_ptr<umbridge::Model>(CreateUmbridgePDESolver(conf));
//}
\ No newline at end of file
#ifndef UMBRIDGEPDESOLVERS_HPP
#define UMBRIDGEPDESOLVERS_HPP
#include "../../umbridge/lib/umbridge.h"
#include "EllipticPDESolver.hpp"
class UmbridgeEllipticPDESolver : public EllipticPDESolver, public umbridge::Model {
public:
UmbridgeEllipticPDESolver(const PDESolverConfig &conf) :
umbridge::Model("forward"),
EllipticPDESolver(conf) {}
// Define input and output dimensions of model (here we have a single vector of length 1 for input; same for output)
std::vector<std::size_t> GetInputSizes(const json &config_json) const override {
return {1};
}
std::vector<std::size_t> GetOutputSizes(const json &config_json) const override {
return {1};
}
// Define model evaluation; here we simply multiply the first input entry by two.
std::vector<std::vector<double>> Evaluate(const std::vector<std::vector<double>> &inputs, json config_json) override {
// Todo
PPM->Broadcast(inputs[0][0]);
SampleSolution u(GetDisc(), SampleID());
Run(u);
return {{inputs[0][0] * 2.0}};
}
bool SupportsEvaluate() override {
return true;
}
};
umbridge::Model *CreateUmbridgePDESolver(PDESolverConfig conf);
std::unique_ptr<umbridge::Model> CreateUmbridgePDESolverUnique(PDESolverConfig conf);
std::shared_ptr<umbridge::Model> CreateUmbridgePDESolverShared(PDESolverConfig conf);
#endif //UMBRIDGEPDESOLVERS_HPP
Supports Markdown
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