Skip to content

Commit 98c59be

Browse files
authored
Arch+inst (#57)
* architecture * update arch * flat send cost * documentation * bugfix * update architecture * added to_string, removed duplicate comment. * removed some bounds checking * revised bounds checking * revised bounds checking * bugfix
1 parent 8ad7dae commit 98c59be

23 files changed

+1157
-1580
lines changed

include/osp/auxiliary/io/arch_file_reader.hpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ limitations under the License.
1818

1919
#pragma once
2020

21+
#include "osp/bsp/model/BspArchitecture.hpp"
2122
#include <fstream>
2223
#include <iostream>
2324
#include <sstream>
24-
#include "osp/bsp/model/BspArchitecture.hpp"
2525

2626
namespace osp { namespace file_reader {
2727

@@ -31,7 +31,8 @@ bool readBspArchitecture(std::ifstream &infile, BspArchitecture<Graph_t> &archit
3131

3232
// Skip comment lines
3333
while (std::getline(infile, line)) {
34-
if (!line.empty() && line[0] != '%') break;
34+
if (!line.empty() && line[0] != '%')
35+
break;
3536
}
3637

3738
// Parse architecture parameters
@@ -58,24 +59,24 @@ bool readBspArchitecture(std::ifstream &infile, BspArchitecture<Graph_t> &archit
5859
if (0 <= mem_type && mem_type <= 3) {
5960
using memw_t = v_memw_t<Graph_t>;
6061
switch (mem_type) {
61-
case 0:
62-
architecture.setMemoryConstraintType(MEMORY_CONSTRAINT_TYPE::NONE);
63-
break;
64-
case 1:
65-
architecture.setMemoryConstraintType(MEMORY_CONSTRAINT_TYPE::LOCAL);
66-
architecture.setMemoryBound(static_cast<memw_t>(M));
67-
break;
68-
case 2:
69-
architecture.setMemoryConstraintType(MEMORY_CONSTRAINT_TYPE::GLOBAL);
70-
architecture.setMemoryBound(static_cast<memw_t>(M));
71-
break;
72-
case 3:
73-
architecture.setMemoryConstraintType(MEMORY_CONSTRAINT_TYPE::PERSISTENT_AND_TRANSIENT);
74-
architecture.setMemoryBound(static_cast<memw_t>(M));
75-
break;
76-
default:
77-
std::cerr << "Invalid memory type.\n";
78-
return false;
62+
case 0:
63+
architecture.setMemoryConstraintType(MEMORY_CONSTRAINT_TYPE::NONE);
64+
break;
65+
case 1:
66+
architecture.setMemoryConstraintType(MEMORY_CONSTRAINT_TYPE::LOCAL);
67+
architecture.setMemoryBound(static_cast<memw_t>(M));
68+
break;
69+
case 2:
70+
architecture.setMemoryConstraintType(MEMORY_CONSTRAINT_TYPE::GLOBAL);
71+
architecture.setMemoryBound(static_cast<memw_t>(M));
72+
break;
73+
case 3:
74+
architecture.setMemoryConstraintType(MEMORY_CONSTRAINT_TYPE::PERSISTENT_AND_TRANSIENT);
75+
architecture.setMemoryBound(static_cast<memw_t>(M));
76+
break;
77+
default:
78+
std::cerr << "Invalid memory type.\n";
79+
return false;
7980
}
8081
} else if (mem_type == -1) {
8182
std::cout << "No memory type specified. Assuming \"NONE\".\n";
@@ -116,7 +117,7 @@ bool readBspArchitecture(std::ifstream &infile, BspArchitecture<Graph_t> &archit
116117
return false;
117118
}
118119

119-
architecture.setSendCosts(fromProc, toProc, static_cast<v_commw_t<Graph_t>>(value));
120+
architecture.SetSendCosts(fromProc, toProc, static_cast<v_commw_t<Graph_t>>(value));
120121
}
121122

122123
// Ensure there are no remaining non-comment lines
@@ -127,7 +128,6 @@ bool readBspArchitecture(std::ifstream &infile, BspArchitecture<Graph_t> &archit
127128
}
128129
}
129130

130-
architecture.computeCommAverage();
131131
return true;
132132
}
133133

0 commit comments

Comments
 (0)