Skip to content

Commit

Permalink
Merge pull request #315 from yisangriB/updating_smelt2
Browse files Browse the repository at this point in the history
Removing MKL and IPP from smelt
  • Loading branch information
fmckenna authored Sep 11, 2024
2 parents 53b914c + ba0f5f5 commit 5edeb2f
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 28 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ UserDefinedEDP
SiteResponse
MDOF_BuildingModel
ExtractPGA
StochasticWind
StochasticGroundMotion
StandardEarthquakeEDP
OpenSeesInput
OpenSeesPostprocessor
Expand Down
4 changes: 2 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ class simCenterBackendApps(ConanFile): # noqa: D101
}
options = {'shared': [True, False]} # noqa: RUF012
default_options = { # noqa: RUF012
'mkl-static:threaded': False,
'ipp-static:simcenter_backend': True,
'libcurl:with_ssl': 'openssl',
}
generators = 'cmake'
Expand All @@ -33,6 +31,8 @@ class simCenterBackendApps(ConanFile): # noqa: D101
'jsonformoderncpp/3.7.0',
'nanoflann/1.3.2',
'nlopt/2.7.1',
'smelt/1.2.0@simcenter/stable',
'kissfft/131.1.0',
]

# Custom attributes for Bincrafters recipe conventions
Expand Down
4 changes: 2 additions & 2 deletions modules/createEVENT/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ add_subdirectory(pointWindSpeed)
add_subdirectory(LLNL_SW4)
add_subdirectory(SimCenterEvent)
add_subdirectory(ASCE7_WindSpeed)
#add_subdirectory(stochasticGroundMotion)
#add_subdirectory(stochasticWind)
add_subdirectory(stochasticGroundMotion)
add_subdirectory(stochasticWind)
add_subdirectory(groundMotionIM)
add_subdirectory(uniformPEER)
add_subdirectory(experimentalWindForces)
Expand Down
2 changes: 1 addition & 1 deletion modules/createEVENT/stochasticGroundMotion/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
simcenter_add_executable(NAME StochasticGM
DEPENDS CONAN_PKG::smelt CONAN_PKG::ipp-static CONAN_PKG::mkl-static)
DEPENDS CONAN_PKG::smelt CONAN_PKG::kissfft)

set_property(TARGET StochasticGM PROPERTY CXX_STANDARD 17)
3 changes: 2 additions & 1 deletion modules/createEVENT/stochasticGroundMotion/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ void throwError(std::string msg){
std::string filePathString = cwd.string();
std::size_t loc_dot = filePathString.find_last_of(".");
int id = std::stoi(filePathString.substr(loc_dot+1)) ;
std::string errFile = "../workflow.err." + std::to_string(id); // e.g. workflow.err.1
//std::string errFile = "../workflow.err." + std::to_string(id); // e.g. workflow.err.1
std::string errFile = "./workflow.err"; // e.g. workflow.err

//
// Write msg to the file
Expand Down
5 changes: 3 additions & 2 deletions modules/createEVENT/stochasticWind/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
simcenter_add_executable(NAME StochasticWind
DEPENDS CONAN_PKG::smelt CONAN_PKG::ipp-static
CONAN_PKG::mkl-static common)
DEPENDS CONAN_PKG::smelt CONAN_PKG::kissfft common)

set_property(TARGET StochasticWind PROPERTY CXX_STANDARD 17)
77 changes: 59 additions & 18 deletions modules/createEVENT/stochasticWind/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "command_parser.h"
#include "function_dispatcher.h"
#include "wind_generator.h"
#include <filesystem>

using json = nlohmann::json;
typedef std::chrono::duration<
Expand Down Expand Up @@ -121,24 +122,64 @@ int main(int argc, char** argv) {
auto nanoseconds =
std::chrono::duration_cast<std::chrono::nanoseconds>(duration);

auto wind_forces =
inputs.seed_provided()
? Dispatcher<std::tuple<std::vector<double>, json>, std::string,
double, double, double, double, unsigned int,
double, double, int>::instance()
->dispatch("WittigSinha1975", exposure_category,
gust_wind_speed, drag_coeff, width, height,
num_floors, total_time, force_conversion,
inputs.get_seed())
: Dispatcher<std::tuple<std::vector<double>, json>, std::string,
double, double, double, double, unsigned int,
double, double, int>::instance()
->dispatch("WittigSinha1975", exposure_category,
gust_wind_speed, drag_coeff, width, height,
num_floors, total_time, force_conversion,
nanoseconds.count());

auto static_forces = std::get<0>(wind_forces);

// main seed
int seed;
if (input_data["Events"][0]["seed"].is_string()) {
// if this is "None"
seed = nanoseconds.count();

} else {

int base_seed = input_data["Events"][0]["seed"].get<int>();

// Get the current working directory
std::string folderName = std::filesystem::path(std::filesystem::current_path()).filename().string();


// Split by '.' and get the last part (sampNum)
std::size_t pos = folderName.find_last_of('.');

if (pos!= std::string::npos) {
std::string samp_num_str = (pos != std::string::npos) ? folderName.substr(pos + 1) : folderName;
int samp_num = std::stoi(samp_num_str);
seed = samp_num + base_seed;
} else {
seed = base_seed;
}


}


std::cout << seed << std::endl;
auto wind_forces = Dispatcher<std::tuple<std::vector<double>, json>, std::string,
double, double, double, double, unsigned int,
double, double, int>::instance()
->dispatch("WittigSinha1975", exposure_category,
gust_wind_speed, drag_coeff, width, height,
num_floors, total_time, force_conversion,
seed);

// auto wind_forces =
// inputs.seed_provided()
// ? Dispatcher<std::tuple<std::vector<double>, json>, std::string,
// double, double, double, double, unsigned int,
// double, double, int>::instance()
// ->dispatch("WittigSinha1975", exposure_category,
// gust_wind_speed, drag_coeff, width, height,
// num_floors, total_time, force_conversion,
// inputs.get_seed())
// : Dispatcher<std::tuple<std::vector<double>, json>, std::string,
// double, double, double, double, unsigned int,
// double, double, int>::instance()
// ->dispatch("WittigSinha1975", exposure_category,
// gust_wind_speed, drag_coeff, width, height,
// num_floors, total_time, force_conversion,
// nanoseconds.count());


auto static_forces = std::get<0>(wind_forces);
auto dynamic_forces = std::get<1>(wind_forces);
auto pattern = json::array();
auto time_series = json::array();
Expand Down

0 comments on commit 5edeb2f

Please sign in to comment.