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.
Merge branch 'master' of https://github.com/sstsimulator/sst-macro
Conflicts: Makefile.am
- Loading branch information
Showing
38 changed files
with
558 additions
and
104 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#include <sstmac/backends/common/parallel_runtime.h> | ||
#include <sstmac/common/stats/stat_local_int.h> | ||
#include <sprockit/spkt_string.h> | ||
#include <sprockit/sim_parameters.h> | ||
#include <sprockit/output.h> | ||
#include <sprockit/util.h> | ||
#include <math.h> | ||
|
||
namespace sstmac { | ||
|
||
SpktRegister("local_int", stat_collector, stat_local_int); | ||
|
||
stat_local_int::stat_local_int() : | ||
size_(0), | ||
id_(-1), | ||
value_(0) | ||
{ | ||
} | ||
|
||
void | ||
stat_local_int::global_reduce(parallel_runtime *rt) | ||
{ | ||
if (rt->nproc() == 1) | ||
return; | ||
spkt_throw(sprockit::unimplemented_error, "stat_local_int::global_reduce"); | ||
} | ||
|
||
void | ||
stat_local_int::reduce(stat_collector *coll) | ||
{ | ||
stat_local_int* other = safe_cast(stat_local_int, coll); | ||
if ((other->id_ + 1) > size_) { | ||
size_ = other->id_ + 1; | ||
values_.resize(size_); | ||
} | ||
values_[other->id_] = other->value_; | ||
} | ||
|
||
void | ||
stat_local_int::dump(const std::string& froot) | ||
{ | ||
std::string data_file = froot + ".dat"; | ||
std::fstream data_str; | ||
check_open(data_str, data_file); | ||
data_str << "Id Value\n"; | ||
for (int i=0; i < values_.size(); ++i) | ||
data_str << sprockit::printf("%i %i\n", i, values_[i]); | ||
data_str.close(); | ||
} | ||
|
||
void | ||
stat_local_int::dump_global_data() | ||
{ | ||
dump(fileroot_); | ||
} | ||
|
||
void | ||
stat_local_int::dump_local_data() | ||
{ | ||
std::string fname = sprockit::printf("%s.%d", fileroot_.c_str(), id_); | ||
dump(fname); | ||
} | ||
|
||
void | ||
stat_local_int::clear() | ||
{ | ||
} | ||
|
||
void | ||
stat_local_int::collect(int value) | ||
{ | ||
value_ += value; | ||
} | ||
|
||
void | ||
stat_local_int::clone_into(stat_local_int* vec) const { | ||
stat_collector::clone_into(vec); | ||
} | ||
|
||
void | ||
stat_local_int::init_factory_params(sprockit::sim_parameters *params) | ||
{ | ||
stat_collector::init_factory_params(params); | ||
} | ||
|
||
void | ||
stat_local_int::simulation_finished(timestamp end) | ||
{ | ||
} | ||
|
||
|
||
|
||
|
||
} |
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,74 @@ | ||
#ifndef STAT_LOCAL_INT_H | ||
#define STAT_LOCAL_INT_H | ||
|
||
#include <sstmac/common/stats/stat_collector.h> | ||
#include <vector> | ||
|
||
namespace sstmac | ||
{ | ||
|
||
class stat_local_int : | ||
public stat_collector | ||
{ | ||
public: | ||
stat_local_int(); | ||
|
||
void | ||
init(int id) { | ||
id_ = id; | ||
} | ||
|
||
void | ||
collect(int value); | ||
|
||
void | ||
simulation_finished(timestamp end); | ||
|
||
void | ||
dump_local_data(); | ||
|
||
void | ||
dump_global_data(); | ||
|
||
void | ||
global_reduce(parallel_runtime *rt); | ||
|
||
void | ||
clear(); | ||
|
||
void | ||
reduce(stat_collector *coll); | ||
|
||
void | ||
init_factory_params(sprockit::sim_parameters *params); | ||
|
||
stat_local_int* | ||
clone_me(int id) const { | ||
stat_local_int* cln = new stat_local_int; | ||
clone_into(cln); | ||
cln->set_id(id); | ||
return cln; | ||
} | ||
|
||
stat_collector* | ||
clone() const { | ||
return clone_me(-1); | ||
} | ||
|
||
protected: | ||
void | ||
dump(const std::string& froot); | ||
|
||
void | ||
clone_into(stat_local_int* cln) const; | ||
|
||
protected: | ||
int size_; | ||
int id_; | ||
int value_; | ||
std::vector<int> values_; | ||
}; | ||
|
||
} | ||
|
||
#endif // STAT_LOCAL_INT_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,10 @@ | ||
#ifndef STAT_LOCAL_INT_FWD_H | ||
#define STAT_LOCAL_INT_FWD_H | ||
|
||
namespace sstmac { | ||
|
||
class stat_local_int; | ||
|
||
} | ||
|
||
#endif // STAT_LOCAL_INT_FWD_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
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
Oops, something went wrong.