forked from sstsimulator/sst-macro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
some additions for running UQ, not yet tested
- Loading branch information
jjwilke
committed
Mar 4, 2016
1 parent
e3b1245
commit 218b704
Showing
52 changed files
with
251 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,8 @@ machines \ | |
blas \ | ||
sumi \ | ||
sockets \ | ||
pthread | ||
pthread \ | ||
uq | ||
|
||
if WITH_DEFAULT_MPI | ||
SUBDIRS += mpi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# | ||
# This file is part of SST/macroscale: | ||
# The macroscale architecture simulator from the SST suite. | ||
# Copyright (c) 2009 Sandia Corporation. | ||
# This software is distributed under the BSD License. | ||
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, | ||
# the U.S. Government retains certain rights in this software. | ||
# For more information, see the LICENSE file in the top | ||
# SST/macroscale directory. | ||
# | ||
|
||
include $(top_srcdir)/Makefile.common | ||
|
||
noinst_LTLIBRARIES = libsstmac_uq.la | ||
|
||
libsstmac_uq_la_SOURCES = \ | ||
uq.cc | ||
|
||
library_includedir=$(includedir)/sstmac/libraries/uq | ||
|
||
nobase_library_include_HEADERS = \ | ||
uq.h | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include <sstmac/libraries/uq/uq.h> | ||
#include <sstmac/main/driver.h> | ||
#include <sprockit/errors.h> | ||
|
||
using namespace sstmac; | ||
|
||
extern "C" void* | ||
sstmac_uq_init(int argc, char** argv) | ||
{ | ||
SimulationQueue* q = new SimulationQueue; | ||
q->init(argc, argv); | ||
return q; | ||
} | ||
|
||
extern "C" void | ||
sstmac_uq_finalize(void* queue) | ||
{ | ||
SimulationQueue* q = (SimulationQueue*) queue; | ||
delete q; | ||
} | ||
|
||
static void | ||
wait_sims(Simulation** sims, int nsims, double** results, int nresults) | ||
{ | ||
for (int i=0; i < nsims; ++i){ | ||
sims[i]->wait(); | ||
results[i] = sims[i]->results(); | ||
if (sims[i]->numResults() != nresults){ | ||
spkt_abort_printf("got wrong number of results: expected %d, got %d", | ||
nresults, sims[i]->numResults()); | ||
} | ||
delete sims[i]; | ||
} | ||
} | ||
|
||
extern "C" void | ||
sstmac_uq_run(void* queue, | ||
int njobs, int nparams, int nresults, int max_nthread, | ||
const char* param_names[], double* param_values[], | ||
double* results[]) | ||
{ | ||
SimulationQueue* q = (SimulationQueue*) queue; | ||
sprockit::sim_parameters params; | ||
Simulation* sims[max_nthread]; | ||
|
||
int num_running = 0; | ||
|
||
for (int j=0; j < njobs; ++j, ++num_running){ | ||
if (num_running == max_nthread){ | ||
int result_offset = j - max_nthread; | ||
wait_sims(sims, max_nthread, results+result_offset, nresults); | ||
num_running = 0; | ||
} | ||
double* param_vals = param_values[j]; | ||
for (int param=0; param < nparams; ++param){ | ||
params[param_names[param]] = param_vals[param]; | ||
} | ||
sims[num_running++] = q->fork(params); | ||
} | ||
int result_offset = njobs - num_running; | ||
wait_sims(sims, num_running, results+result_offset, nresults); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
void* sstmac_uq_init(int argc, char** argv); | ||
|
||
void sstmac_uq_run(void* queue, | ||
int njobs, int nparams, int nresults, int max_nthread, | ||
const char* param_names[], double* param_values[], | ||
double* results[]); | ||
|
||
void sstmac_uq_finalize(void* queue); | ||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
Oops, something went wrong.