Skip to content

Commit

Permalink
change node index from int16_t to int64_t (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
ywwu928 authored May 14, 2024
1 parent e154a8d commit 7ff8c51
Show file tree
Hide file tree
Showing 38 changed files with 187 additions and 187 deletions.
6 changes: 3 additions & 3 deletions include/pando-lib-galois/containers/dist_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class DistArray {
pando::Status err = hostsPlaces.initialize(pando::getPlaceDims().node.id);
PANDO_CHECK_RETURN(err);

for (std::int16_t i = 0; i < pando::getPlaceDims().node.id; i++) {
for (std::int64_t i = 0; i < pando::getPlaceDims().node.id; i++) {
hostsPlaces[i] = PlaceType{pando::Place{pando::NodeIndex{i}, pando::anyPod, pando::anyCore},
pando::MemoryType::Main};
}
Expand Down Expand Up @@ -321,7 +321,7 @@ class DistArray {
* @brief A beginning local iterator for a specified node `n` that
* points to the first local item of this distributed array.
*/
pando::GlobalPtr<T> localBegin(std::int16_t n) noexcept {
pando::GlobalPtr<T> localBegin(std::int64_t n) noexcept {
pando::Array<T> arr = m_data[n];
return pando::GlobalPtr<T>(arr.begin());
}
Expand All @@ -330,7 +330,7 @@ class DistArray {
* @brief A ending local iterator for a specified node `n` that
* points to (the last local item of this distributed array + 1).
*/
pando::GlobalPtr<T> localEnd(std::int16_t n) noexcept {
pando::GlobalPtr<T> localEnd(std::int64_t n) noexcept {
pando::Array<T> arr = m_data[n];
return pando::GlobalPtr<T>(arr.end());
}
Expand Down
6 changes: 3 additions & 3 deletions include/pando-lib-galois/containers/host_indexed_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,16 @@ class HostIndexedMap {
template <typename T>
class HostIndexedMapIt {
pando::GlobalPtr<T> m_curr;
std::int16_t m_loc;
std::int64_t m_loc;

public:
using iterator_category = std::random_access_iterator_tag;
using difference_type = std::int16_t;
using difference_type = std::int64_t;
using value_type = T;
using pointer = pando::GlobalPtr<T>;
using reference = pando::GlobalRef<T>;

HostIndexedMapIt(pando::GlobalPtr<T> curr, std::int16_t loc) : m_curr(curr), m_loc(loc) {}
HostIndexedMapIt(pando::GlobalPtr<T> curr, std::int64_t loc) : m_curr(curr), m_loc(loc) {}

constexpr HostIndexedMapIt() noexcept = default;
constexpr HostIndexedMapIt(HostIndexedMapIt&&) noexcept = default;
Expand Down
10 changes: 5 additions & 5 deletions include/pando-lib-galois/containers/host_local_storage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ class HostLocalStorage {
}

pando::GlobalPtr<T> get(std::uint64_t i) noexcept {
return m_items.getPointerAt(pando::NodeIndex(static_cast<std::int16_t>(i)));
return m_items.getPointerAt(pando::NodeIndex(static_cast<std::int64_t>(i)));
}

pando::GlobalPtr<const T> get(std::uint64_t i) const noexcept {
return m_items.getPointerAt(pando::NodeIndex(static_cast<std::int16_t>(i)));
return m_items.getPointerAt(pando::NodeIndex(static_cast<std::int64_t>(i)));
}

pando::GlobalRef<T> operator[](std::uint64_t i) noexcept {
Expand Down Expand Up @@ -184,16 +184,16 @@ class HostLocalStorage {
template <typename T>
class HostLocalStorageIt {
HostLocalStorage<T> m_curr;
std::int16_t m_loc;
std::int64_t m_loc;

public:
using iterator_category = std::random_access_iterator_tag;
using difference_type = std::int16_t;
using difference_type = std::int64_t;
using value_type = T;
using pointer = pando::GlobalPtr<T>;
using reference = pando::GlobalRef<T>;

HostLocalStorageIt(HostLocalStorage<T> curr, std::int16_t loc) : m_curr(curr), m_loc(loc) {}
HostLocalStorageIt(HostLocalStorage<T> curr, std::int64_t loc) : m_curr(curr), m_loc(loc) {}

constexpr HostLocalStorageIt() noexcept = default;
constexpr HostLocalStorageIt(HostLocalStorageIt&&) noexcept = default;
Expand Down
4 changes: 2 additions & 2 deletions include/pando-lib-galois/containers/per_thread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ class PerThreadVector {

// TODO(AdityaAtulTewari) Make this properly parallel.
// Initialize the per host vectors
for (std::int16_t i = 0; i < static_cast<std::int16_t>(lift(flat, getNumHosts)); i++) {
for (std::int64_t i = 0; i < static_cast<std::int64_t>(lift(flat, getNumHosts)); i++) {
auto place = pando::Place{pando::NodeIndex{i}, pando::anyPod, pando::anyCore};
auto ref = fmap(flat, operator[], i);
std::uint64_t start =
Expand Down Expand Up @@ -342,7 +342,7 @@ class PerThreadVector {

// TODO(AdityaAtulTewari) Make this properly parallel.
// Initialize the per host vectors
for (std::int16_t i = 0; i < static_cast<std::int16_t>(flat.getNumHosts()); i++) {
for (std::int64_t i = 0; i < static_cast<std::int64_t>(flat.getNumHosts()); i++) {
auto ref = flat[i];
std::uint64_t start =
(i == 0) ? 0 : m_indices[static_cast<std::uint64_t>(i) * cores * threads - 1];
Expand Down
4 changes: 2 additions & 2 deletions include/pando-lib-galois/graphs/dist_array_csr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class DistArrayCSR {
err = vec.initialize(pando::getPlaceDims().node.id);
PANDO_CHECK_RETURN(err);

for (std::int16_t i = 0; i < pando::getPlaceDims().node.id; i++) {
for (std::int64_t i = 0; i < pando::getPlaceDims().node.id; i++) {
vec[i] = PlaceType{pando::Place{pando::NodeIndex{i}, pando::anyPod, pando::anyCore},
pando::MemoryType::Main};
}
Expand Down Expand Up @@ -464,7 +464,7 @@ class DistArrayCSR {
err = vec.initialize(pando::getPlaceDims().node.id);
PANDO_CHECK_RETURN(err);

for (std::int16_t i = 0; i < pando::getPlaceDims().node.id; i++) {
for (std::int64_t i = 0; i < pando::getPlaceDims().node.id; i++) {
vec[i] = PlaceType{pando::Place{pando::NodeIndex{i}, pando::anyPod, pando::anyCore},
pando::MemoryType::Main};
}
Expand Down
18 changes: 9 additions & 9 deletions include/pando-lib-galois/graphs/dist_local_csr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class DistLocalCSR {
pointer ptr = m_pos + 1;
CSR csrCurr = getCachedCSR(arrayOfCSRs, currNode);
if (csrCurr.vertexEdgeOffsets.end() - 1 > ptr ||
(int16_t)currNode == pando::getPlaceDims().node.id - 1) {
(int64_t)currNode == pando::getPlaceDims().node.id - 1) {
m_pos = ptr;
} else {
csrCurr = getCachedCSR(arrayOfCSRs, currNode + 1);
Expand Down Expand Up @@ -582,7 +582,7 @@ class DistLocalCSR {
};

for (std::uint64_t i = 0; i < numHosts; i++) {
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int16_t>(i)},
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int64_t>(i)},
pando::anyPod, pando::anyCore};
PANDO_CHECK(
pando::executeOn(place, createCSRFuncs, this->arrayOfCSRs, vertexData, numEdges, i, wgh));
Expand Down Expand Up @@ -631,7 +631,7 @@ class DistLocalCSR {
wgh.done();
};
for (std::uint64_t i = 0; i < numHosts; i++) {
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int16_t>(i)},
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int64_t>(i)},
pando::anyPod, pando::anyCore};
PANDO_CHECK_RETURN(
pando::executeOn(place, fillCSRFuncs, *this, vertexData, edgeData, edgeMap, i, wgh));
Expand Down Expand Up @@ -791,7 +791,7 @@ class DistLocalCSR {
PANDO_CHECK(wg.initialize(numHosts));
auto wgh = wg.getHandle();
for (std::uint64_t i = 0; i < numHosts; i++) {
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int16_t>(i)},
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int64_t>(i)},
pando::anyPod, pando::anyCore};
PANDO_CHECK(pando::executeOn(place, createMirrors, partEdges, mirrorList, V2PM, i, wgh));
}
Expand Down Expand Up @@ -901,11 +901,11 @@ class DistLocalCSR {
uint64_t numLocalEdges = edgesEnd - edgesStart;
PANDO_CHECK(currentCSR.initializeTopologyMemory(
vertex, numLocalEdges,
pando::Place{pando::NodeIndex{(int16_t)host}, pando::anyPod, pando::anyCore},
pando::Place{pando::NodeIndex{(int64_t)host}, pando::anyPod, pando::anyCore},
pando::MemoryType::Main));
PANDO_CHECK(currentCSR.initializeDataMemory(
vertex, numLocalEdges,
pando::Place{pando::NodeIndex{(int16_t)host}, pando::anyPod, pando::anyCore},
pando::Place{pando::NodeIndex{(int64_t)host}, pando::anyPod, pando::anyCore},
pando::MemoryType::Main));

uint64_t currLocalEdge = 0;
Expand All @@ -922,7 +922,7 @@ class DistLocalCSR {
currentCSR.vertexEdgeOffsets[vertex] = Vertex{&currentCSR.edgeDestinations[currLocalEdge]};

PANDO_CHECK(fmap(arrayOfCSRs[host], initialize,
pando::Place{pando::NodeIndex{(int16_t)host}, pando::anyPod, pando::anyCore},
pando::Place{pando::NodeIndex{(int64_t)host}, pando::anyPod, pando::anyCore},
pando::MemoryType::Main));
fmap(arrayOfCSRs[host], operator[], host) = currentCSR;
edgesStart = edgesEnd;
Expand Down Expand Up @@ -1087,7 +1087,7 @@ class DistLocalCSR {

std::uint64_t hosts = static_cast<std::uint64_t>(pando::getPlaceDims().node.id);
for (std::uint64_t i = 0; i < numThreads; i++) {
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int16_t>(i % hosts)},
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int64_t>(i % hosts)},
pando::anyPod, pando::anyCore};
PANDO_CHECK_RETURN(
pando::executeOn(place, &galois::internal::loadVertexFilePerThread<VertexType>,
Expand All @@ -1101,7 +1101,7 @@ class DistLocalCSR {

std::uint64_t hosts = static_cast<std::uint64_t>(pando::getPlaceDims().node.id);
for (std::uint64_t i = 0; i < numThreads; i++) {
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int16_t>(i % hosts)},
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int64_t>(i % hosts)},
pando::anyPod, pando::anyCore};
PANDO_CHECK_RETURN(pando::executeOn(
place, &galois::internal::loadEdgeFilePerThread<EdgeType>, dones.getHandle(i),
Expand Down
18 changes: 9 additions & 9 deletions include/pando-lib-galois/graphs/mirror_dist_local_csr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ class MirrorDistLocalCSR {
};
uint64_t local_mirror_size = 0;
for (std::uint64_t i = 0; i < numHosts; i++) {
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int16_t>(i)},
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int64_t>(i)},
pando::anyPod, pando::anyCore};
PANDO_CHECK(pando::executeOn(place, mirrorAttach, vertexData, mirrorList, i, wgh));
local_mirror_size = lift(mirrorList[i], size);
Expand Down Expand Up @@ -774,7 +774,7 @@ class MirrorDistLocalCSR {
};

for (std::uint64_t i = 0; i < numHosts; i++) {
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int16_t>(i)},
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int64_t>(i)},
pando::anyPod, pando::anyCore};
PANDO_CHECK(
pando::executeOn(place, generateMetadata, *this, this->dlcsr, mirrorList, i, wgh));
Expand Down Expand Up @@ -812,11 +812,11 @@ class MirrorDistLocalCSR {

// initialize localMirrorToRemoteMasterOrderedTable
PANDO_CHECK_RETURN(localMasterToRemoteMirrorTable.initialize());
for (std::int16_t i = 0; i < dims.node.id; i++) {
for (std::int64_t i = 0; i < dims.node.id; i++) {
pando::GlobalRef<pando::Vector<pando::Vector<MirrorToMasterMap>>>
localMasterToRemoteMirrorMap = localMasterToRemoteMirrorTable[i];
PANDO_CHECK_RETURN(fmap(localMasterToRemoteMirrorMap, initialize, dims.node.id));
for (std::int16_t i = 0; i < dims.node.id; i++) {
for (std::int64_t i = 0; i < dims.node.id; i++) {
pando::GlobalRef<pando::Vector<MirrorToMasterMap>> mapVectorFromHost =
fmap(localMasterToRemoteMirrorMap, operator[], i);
PANDO_CHECK_RETURN(fmap(mapVectorFromHost, initialize, 0));
Expand Down Expand Up @@ -855,23 +855,23 @@ class MirrorDistLocalCSR {

/** Testing Purpose **/
pando::GlobalRef<pando::Array<MirrorToMasterMap>> getLocalMirrorToRemoteMasterOrderedMap(
int16_t hostId) {
int64_t hostId) {
return localMirrorToRemoteMasterOrderedTable[hostId];
}
pando::GlobalRef<pando::Vector<pando::Vector<MirrorToMasterMap>>> getLocalMasterToRemoteMirrorMap(
uint64_t hostId) {
return localMasterToRemoteMirrorTable[hostId];
}
pando::GlobalRef<pando::Array<bool>> getMasterBitSet(int16_t hostId) {
pando::GlobalRef<pando::Array<bool>> getMasterBitSet(int64_t hostId) {
return masterBitSets[hostId];
}
pando::GlobalRef<pando::Array<bool>> getMirrorBitSet(int16_t hostId) {
pando::GlobalRef<pando::Array<bool>> getMirrorBitSet(int64_t hostId) {
return mirrorBitSets[hostId];
}
pando::GlobalRef<LocalVertexRange> getMasterRange(int16_t hostId) {
pando::GlobalRef<LocalVertexRange> getMasterRange(int64_t hostId) {
return masterRange[hostId];
}
pando::GlobalRef<LocalVertexRange> getMirrorRange(int16_t hostId) {
pando::GlobalRef<LocalVertexRange> getMirrorRange(int64_t hostId) {
return mirrorRange[hostId];
}

Expand Down
4 changes: 2 additions & 2 deletions include/pando-lib-galois/import/ingest_rmat_el.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ ReturnType initializeELDACSR(pando::Array<char> filename, std::uint64_t numVerti

PANDO_MEM_STAT_NEW_KERNEL("loadELFilePerThread Start");
for (std::uint64_t i = 0; i < numThreads; i++) {
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int16_t>(i % hosts)},
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int64_t>(i % hosts)},
pando::anyPod, pando::anyCore};
PANDO_CHECK(pando::executeOn(place, &galois::loadELFilePerThread, wgh, filename, 1, numThreads,
i, localReadEdges, perThreadRename, numVertices));
Expand Down Expand Up @@ -145,7 +145,7 @@ ReturnType initializeELDLCSR(pando::Array<char> filename, std::uint64_t numVerti

PANDO_MEM_STAT_NEW_KERNEL("loadELFilePerThread Start");
for (std::uint64_t i = 0; i < numThreads; i++) {
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int16_t>(i % hosts)},
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int64_t>(i % hosts)},
pando::anyPod, pando::anyCore};
PANDO_CHECK(pando::executeOn(place, &galois::loadELFilePerThread, wgh, filename, 1, numThreads,
i, localReadEdges, perThreadRename, numVertices));
Expand Down
2 changes: 1 addition & 1 deletion include/pando-lib-galois/import/ingest_wmd_csv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ galois::DistLocalCSR<VertexType, EdgeType> initializeWMDDLCSR(pando::Array<char>

PANDO_MEM_STAT_NEW_KERNEL("loadWMDFilePerThread Start");
for (std::uint64_t i = 0; i < numThreads; i++) {
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int16_t>(i % hosts)},
pando::Place place = pando::Place{pando::NodeIndex{static_cast<std::int64_t>(i % hosts)},
pando::anyPod, pando::anyCore};
PANDO_CHECK(pando::executeOn(place, &galois::loadWMDFilePerThread, wgh, filename, 1, numThreads,
i, localReadEdges, perThreadRename, localReadVertices, totVerts));
Expand Down
8 changes: 4 additions & 4 deletions include/pando-lib-galois/loops/do_all.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,17 +311,17 @@ class DoAll {
const auto end = range.end();

for (auto curr = range.begin(); curr != end; curr++) {
int16_t assignedHost;
int64_t assignedHost;
if (workPerHost > 0) {
assignedHost = (int16_t)(*curr / workPerHost);
assignedHost = (int64_t)(*curr / workPerHost);
} else if (hosts % workItems == 0) {
// Given that we have 8 pxns and we schedule 4 workItems, this will place the workers on the
// even numbered pxns
assignedHost = (int16_t)(*curr * (hosts / workItems));
assignedHost = (int64_t)(*curr * (hosts / workItems));
} else {
// Given that workItems < hosts and workItems does not divide hosts, assign the work
// sequentially
assignedHost = (int16_t)(*curr);
assignedHost = (int64_t)(*curr);
}
if (assignedHost >= pando::getPlaceDims().node.id) {
assignedHost = pando::getPlaceDims().node.id - 1;
Expand Down
2 changes: 1 addition & 1 deletion include/pando-lib-galois/utility/locality.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace galois {
static_cast<std::uint64_t>(placeDims.core.y);
const std::uint64_t threadsPerHost = threadsPerPod * static_cast<std::uint64_t>(placeDims.pod.x) *
static_cast<std::uint64_t>(placeDims.pod.y);
const pando::NodeIndex node(static_cast<int16_t>(idx / threadsPerHost));
const pando::NodeIndex node(static_cast<int64_t>(idx / threadsPerHost));
const std::uint64_t threadPerHostIdx = idx % threadsPerHost;
const std::uint64_t podPerHostIdx = threadPerHostIdx / threadsPerPod;
const pando::PodIndex pod(podPerHostIdx / placeDims.pod.y, podPerHostIdx % placeDims.pod.y);
Expand Down
2 changes: 1 addition & 1 deletion microbench/bfs/include/pando-bfs-galois/sssp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ pando::Status SSSPMDLCSR(G& graph, std::uint64_t src, HostLocalStorage<MDWorkLis
if (found) {
graph.setDataOnly(srcID, 0);

std::int16_t srcHost = graph.getPhysicalHostID(src);
std::int64_t srcHost = graph.getPhysicalHostID(src);
if (srcHost == pando::getCurrentPlace().node.id) {
PANDO_CHECK(fmap(toRead[0], pushBack, srcID));
}
Expand Down
2 changes: 1 addition & 1 deletion pando-rt/examples/gups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ int pandoMain(int argc, char** argv) {
tablePtr =
static_cast<pando::GlobalPtr<std::int64_t>>(memoryResource->allocate(tableByteCount));

for (std::int16_t nodeId = 0; nodeId < placeDims.node.id; ++nodeId) {
for (std::int64_t nodeId = 0; nodeId < placeDims.node.id; ++nodeId) {
for (std::int8_t podX = 0; podX < placeDims.pod.x; ++podX) {
for (std::int8_t podY = 0; podY < placeDims.pod.y; ++podY) {
for (std::int8_t coreX = 0; coreX < placeDims.core.x; ++coreX) {
Expand Down
2 changes: 1 addition & 1 deletion pando-rt/examples/helloworld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void nodeGreetings(int level) {

if (level < 2) {
pando::NodeIndex rightNode{
static_cast<std::int16_t>((thisPlace.node.id + 1) % placeDims.node.id)};
static_cast<std::int64_t>((thisPlace.node.id + 1) % placeDims.node.id)};
PANDO_CHECK(
pando::executeOn(pando::Place{rightNode, {}, pando::anyCore}, &nodeGreetings, level + 1));
}
Expand Down
Loading

0 comments on commit 7ff8c51

Please sign in to comment.