Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 50 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,62 @@ add_subdirectory(.githooks)
# --- Compile Options Configuration ---
# Common compile options including strict warnings and error-on-warning
set(COMMON_CXX_WARNING_FLAGS
"-Wall"
"-Wextra"
"-Wfatal-errors"
"-Wconversion"
"-Wsign-conversion"
"-Wunused"
"-Wunreachable-code"
"-Wuninitialized"
"-pedantic"
"-Wpedantic"
"-Wold-style-cast"
"-Wcast-align"
"-Werror"
"-Wall"
"-Wextra"
"-Wundef"
"-Wunused"
"-Wcast-qual"
"-Wpointer-arith"
"-Wdate-time"
"-Wfloat-equal"
"-Wformat=2"
"-Wshadow"
"-Wsign-compare"
"-Wunused-macros"
"-Wvla"
"-Wdisabled-optimization"
"-Wempty-body"
"-Wignored-qualifiers"
"-Wtype-limits"
"-Wshift-negative-value"
"-Wswitch-default"
"-Woverloaded-virtual"
"-Wnon-virtual-dtor"
"-Wshift-overflow=2"
"-Wshift-count-overflow"
"-Wwrite-strings"
"-Wmissing-format-attribute"
"-Wformat-nonliteral"
"-Wduplicated-cond"
"-Wtrampolines"
"-Wsized-deallocation"
"-Wlogical-op"
"-Wsuggest-attribute=format"
"-Wduplicated-branches"
"-Wmissing-include-dirs"
"-Wformat-signedness"
"-Wreturn-local-addr"
"-Wredundant-decls"
"-Wfloat-conversion"
"-fno-common"
"-fno-strict-aliasing"
"-Wno-return-type"
"-Wno-array-bounds"
"-Wno-maybe-uninitialized"
"-Wno-unused-but-set-variable"
"-Wno-unused-variable"
"-Wno-unused-parameter"
"-Wno-unused-result"
)

# --- Project-specific Compile Flags ---
Expand Down
2 changes: 1 addition & 1 deletion apps/coarser_plotter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ int main(int argc, char *argv[]) {
}

return 0;
};
}
6 changes: 3 additions & 3 deletions apps/graph_analyser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void add_graph_stats(const ComputationalDag &graph, std::ofstream &outfile) {
Get_Median(edge_lengths);

if (graph.num_edges() != 0) {
avg_edge_length = (float)sum_edge_length / (float)graph.num_edges();
avg_edge_length = static_cast<float>(sum_edge_length) / static_cast<float>(graph.num_edges());
}

// Longest Path
Expand All @@ -72,15 +72,15 @@ void add_graph_stats(const ComputationalDag &graph, std::ofstream &outfile) {
// wavefront[top_level[i]] = 1;
// }
}
float avg_wavefront = (float)graph.num_vertices() / (float)longest_path;
float avg_wavefront = static_cast<float>(graph.num_vertices()) / static_cast<float>(longest_path);

// Average bottom distance
std::vector<unsigned> bot_level = get_bottom_node_distance(graph);
size_t bot_level_sum = 0;
for (size_t i = 0; i < bot_level.size(); i++) {
bot_level_sum += bot_level[i];
}
float avg_bot_level = (float)bot_level_sum / (float)bot_level.size();
float avg_bot_level = static_cast<float>(bot_level_sum) / static_cast<float>(bot_level.size());

// // Number of Triangles
// size_t number_triangles = 0;
Expand Down
4 changes: 2 additions & 2 deletions apps/graph_generator/gen_Erdos-Renyi_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int main(int argc, char *argv[]) {
std::uniform_real_distribution<double> unif_log(-std::log(upper_bound), std::log(upper_bound));
std::default_random_engine re;

for (size_t i = 0; i < num_graphs; i++) {
for (size_t j = 0; j < num_graphs; j++) {
// Generating the graph
ComputationalDag graph;
erdos_renyi_graph_gen(graph, num_vert, chance);
Expand All @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) {
}
graph_name += graph_edge_size;

graph_name += std::to_string(i);
graph_name += std::to_string(j);

graph_name += ".mtx";

Expand Down
12 changes: 6 additions & 6 deletions apps/graph_generator/gen_near_diag_random_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ int main(int argc, char *argv[]) {

// Generating graph name
std::string graph_name = "RandomBand_";
graph_name += "p" + std::to_string((int)(100 * prob)) + "_";
graph_name += "b" + std::to_string((int)bandwidth) + "_";
graph_name += "p" + std::to_string(static_cast<int>(100 * prob)) + "_";
graph_name += "b" + std::to_string(static_cast<int>(bandwidth)) + "_";
std::string graph_size_name;
if (graph.num_vertices() < 1000) {
graph_size_name = std::to_string(graph.num_vertices()) + "_";
Expand Down Expand Up @@ -105,12 +105,12 @@ int main(int argc, char *argv[]) {
graph_write << header;
graph_write << std::to_string(graph.num_vertices()) + " " + std::to_string(graph.num_vertices()) + " " +
std::to_string(graph.num_edges() + graph.num_vertices()) + "\n";
for (VertexType i = 0; i < num_vert; i++) {
for (VertexType j = 0; j < num_vert; j++) {
double val = (1 - 2 * randInt(2)) * std::exp(unif_log(re));
graph_write << std::to_string(i + 1) + " " + std::to_string(i + 1) + " " + std::to_string(val) + "\n";
for (const auto &chld : graph.children(i)) {
graph_write << std::to_string(j + 1) + " " + std::to_string(j + 1) + " " + std::to_string(val) + "\n";
for (const auto &chld : graph.children(j)) {
val = unif(re);
graph_write << std::to_string(chld + 1) + " " + std::to_string(i + 1) + " " + std::to_string(val) +
graph_write << std::to_string(chld + 1) + " " + std::to_string(j + 1) + " " + std::to_string(val) +
"\n";
}
}
Expand Down
6 changes: 3 additions & 3 deletions apps/test_suite_runner/StatsModules/BspSptrsvStatsModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ bool compare_vectors(Eigen::VectorXd &v1, Eigen::VectorXd &v2) {
}
}
return same;
};
}

template<typename TargetObjectType>
class BspSptrsvStatsModule : public IStatisticModule<TargetObjectType> {
public:
explicit BspSptrsvStatsModule(SCHEDULE_NODE_PERMUTATION_MODES mode = NO_PERMUTE)
: mode(mode) {}
explicit BspSptrsvStatsModule(SCHEDULE_NODE_PERMUTATION_MODES _mode = NO_PERMUTE)
: mode(_mode) {}


std::vector<std::string> get_metric_headers() const override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ RETURN_STATUS run_bsp_recomp_scheduler(const ConfigParser &parser, const boost::

throw std::invalid_argument("Parameter error: Unknown algorithm.\n");
}
};
}

} // namespace osp
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,6 @@ RETURN_STATUS run_bsp_scheduler(const ConfigParser &parser, const boost::propert
auto scheduler = get_base_bsp_scheduler_by_name<Graph_t>(parser, algorithm);
return scheduler->computeSchedule(schedule);
}
};
}

} // namespace osp
2 changes: 2 additions & 0 deletions include/osp/auxiliary/Balanced_Coin_Flips.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class BalancedCoinFlips {
/// @brief Returns true/false in a pseudo-random balanced manner
/// @return true/false
virtual bool get_flip() = 0;

virtual ~BalancedCoinFlips() = default;
};

class Biased_Random : public BalancedCoinFlips {
Expand Down
3 changes: 3 additions & 0 deletions include/osp/auxiliary/io/arch_file_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ bool readBspArchitecture(std::ifstream &infile, BspArchitecture<Graph_t> &archit
architecture.setMemoryConstraintType(MEMORY_CONSTRAINT_TYPE::PERSISTENT_AND_TRANSIENT);
architecture.setMemoryBound(static_cast<memw_t>(M));
break;
default:
std::cerr << "Invalid memory type.\n";
return false;
}
} else if (mem_type == -1) {
std::cout << "No memory type specified. Assuming \"NONE\".\n";
Expand Down
8 changes: 4 additions & 4 deletions include/osp/auxiliary/io/bsp_schedule_file_writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace osp { namespace file_writer {
template<typename Graph_t>
void write_txt(std::ostream &os, const BspSchedule<Graph_t> &schedule) {

os << "\%\% BspSchedule for " << schedule.getInstance().numberOfProcessors() << " processors and "
os << "%% BspSchedule for " << schedule.getInstance().numberOfProcessors() << " processors and "
<< schedule.numberOfSupersteps() << " supersteps." << std::endl;
os << schedule.getInstance().numberOfVertices() << " " << schedule.getInstance().numberOfProcessors() << " "
<< schedule.numberOfSupersteps() << std::endl;
Expand All @@ -48,7 +48,7 @@ void write_txt(const std::string &filename, const BspSchedule<Graph_t> &schedule
template<typename Graph_t>
void write_txt(std::ostream &os, const BspScheduleCS<Graph_t> &schedule) {

os << "\%\% BspSchedule for " << schedule.getInstance().numberOfProcessors() << " processors and "
os << "%% BspSchedule for " << schedule.getInstance().numberOfProcessors() << " processors and "
<< schedule.numberOfSupersteps() << " supersteps." << std::endl;
os << schedule.getInstance().numberOfVertices() << " " << schedule.getInstance().numberOfProcessors() << " "
<< schedule.numberOfSupersteps() << " ";
Expand All @@ -66,10 +66,10 @@ void write_txt(std::ostream &os, const BspScheduleCS<Graph_t> &schedule) {
}

if (schedule.getCommunicationSchedule().empty()) {
os << "\%\% No communication schedule available." << std::endl;
os << "%% No communication schedule available." << std::endl;
} else {

os << "\%\% Communication schedule available." << std::endl;
os << "%% Communication schedule available." << std::endl;

for (const auto &[key, val] : schedule.getCommunicationSchedule()) {
os << std::get<0>(key) << " " << std::get<1>(key) << " " << std::get<2>(key) << " " << val << std::endl;
Expand Down
4 changes: 2 additions & 2 deletions include/osp/auxiliary/io/partitioning_file_writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void write_txt(std::ostream &os, const Partitioning<hypergraph_t> &partition) {

using index_type = typename hypergraph_t::vertex_idx;

os << "\%\% Partitioning for " << partition.getInstance().getNumberOfPartitions() << " parts." << std::endl;
os << "%% Partitioning for " << partition.getInstance().getNumberOfPartitions() << " parts." << std::endl;

for(index_type node = 0; node < partition.getInstance().getHypergraph().num_vertices(); ++node)
os << node << " " << partition.assignedPartition(node) << std::endl;
Expand All @@ -47,7 +47,7 @@ void write_txt(std::ostream &os, const PartitioningWithReplication<hypergraph_t>

using index_type = typename hypergraph_t::vertex_idx;

os << "\%\% Partitioning for " << partition.getInstance().getNumberOfPartitions() << " parts with replication." << std::endl;
os << "%% Partitioning for " << partition.getInstance().getNumberOfPartitions() << " parts with replication." << std::endl;

for(index_type node = 0; node < partition.getInstance().getHypergraph().num_vertices(); ++node)
{
Expand Down
2 changes: 1 addition & 1 deletion include/osp/auxiliary/io/pebbling_schedule_file_writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void write_txt(std::ostream &os, const PebblingSchedule<Graph_t> &schedule) {

using vertex_idx = vertex_idx_t<Graph_t>;

os << "\%\% PebblingSchedule for " << schedule.getInstance().numberOfProcessors() << " processors and "
os << "%% PebblingSchedule for " << schedule.getInstance().numberOfProcessors() << " processors and "
<< schedule.numberOfSupersteps() << " supersteps." << std::endl;

for(unsigned step = 0; step < schedule.numberOfSupersteps(); ++step)
Expand Down
20 changes: 10 additions & 10 deletions include/osp/auxiliary/misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ inline int randInt(int lim) {
rnd = std::rand();

return rnd % lim;
};
}

// pair of integers
template<typename T1, typename T2>
Expand Down Expand Up @@ -84,7 +84,7 @@ inline bool isDisjoint(std::vector<intPair> &intervals) {
return false;

return true;
};
}

// computes power of an integer
template<typename T>
Expand All @@ -103,7 +103,7 @@ T intpow(T base, unsigned exp) {
return tmp * tmp;
}
return base * tmp * tmp;
};
}

template<typename T>
unsigned uintpow(T base, unsigned exp) {
Expand All @@ -121,7 +121,7 @@ unsigned uintpow(T base, unsigned exp) {
return tmp * tmp;
}
return base * tmp * tmp;
};
}

struct contractionEdge {
intPair edge;
Expand Down Expand Up @@ -166,7 +166,7 @@ std::unordered_set<T> get_intersection(const std::unordered_set<T> &a, const std
}
}
return {result.begin(), result.end()};
};
}

// unordered set union
template<typename T>
Expand All @@ -177,7 +177,7 @@ std::unordered_set<T> get_union(const std::unordered_set<T> &a, const std::unord
larger.emplace(elem);
}
return larger;
};
}

// zip two vectors of equal length
template<typename S, typename T>
Expand Down Expand Up @@ -307,7 +307,7 @@ T Get_Median(SetType ordered_set) {
T val2 = *(++it);
return val1 + (val2 - val1) / 2;
}
};
}

/**
* @brief Get lower_median of a sorted set or multiset
Expand All @@ -324,7 +324,7 @@ T Get_Lower_Median(SetType ordered_set) {

std::advance(it, (ordered_set.size() - 1) / 2);
return *it;
};
}

/**
* @brief Get top third percentile of a sorted set or multiset
Expand All @@ -341,7 +341,7 @@ T Get_upper_third_percentile(SetType ordered_set) {

std::advance(it, (ordered_set.size() / 3) + ((ordered_set.size() + 1) / 3));
return *it;
};
}

/**
* @brief Get lower third percentile of a sorted set or multiset
Expand All @@ -358,6 +358,6 @@ T Get_lower_third_percentile(SetType ordered_set) {

std::advance(it, (ordered_set.size() / 3));
return *it;
};
}

} // namespace osp
4 changes: 2 additions & 2 deletions include/osp/auxiliary/permute.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void permute_inplace(std::vector<T> &vec, std::vector<Ind> &perm) {
}
return true;
}());
assert((void *)&vec != (void *)&perm);
assert(reinterpret_cast<void*>(&vec) != reinterpret_cast<void*>(&perm));

for (Ind i = 0; i < perm.size(); ++i) {
while (perm[i] != i) {
Expand All @@ -66,7 +66,7 @@ void inverse_permute_inplace(std::vector<T> &vec, std::vector<Ind> &perm) {
}
return true;
}());
assert((void *)&vec != (void *)&perm);
assert(reinterpret_cast<void*>(&vec) != reinterpret_cast<void*>(&perm));

for (Ind i = 0; i < perm.size(); ++i) {

Expand Down
Loading