Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f493936
Initial copy-and-paste implementation from MPI.
elliottslaughter Oct 8, 2019
88ce217
Runs correctly with RAW dependencies.
elliottslaughter Oct 14, 2019
4373d21
Event loop implementation.
elliottslaughter Oct 14, 2019
ce62f60
Now with fields.
elliottslaughter Oct 14, 2019
09d43a0
Remove debug printfs and add exit call.
elliottslaughter Oct 14, 2019
c5a483b
Revert "Remove debug printfs and add exit call."
elliottslaughter Oct 14, 2019
55da8e4
Fix for trivial case.
elliottslaughter Oct 14, 2019
7694803
GASNet build and test configuration.
elliottslaughter Oct 14, 2019
1079bbc
Fix bug in stencil_1d_periodic.
elliottslaughter Oct 15, 2019
5efce8f
Fixes for DOM.
elliottslaughter Oct 15, 2019
504640e
Fix a timestep bug.
elliottslaughter Oct 15, 2019
37dc877
Some progress on WAR dependencies. Back to being able to run stencil.
elliottslaughter Oct 15, 2019
1383493
Fix trivial, stencil/no_comm still working.
elliottslaughter Oct 15, 2019
d44aeca
Fix for dom. Trivial, no_comm, stencil, dom now pass in 1 rank. Stenc…
elliottslaughter Oct 15, 2019
acfbf84
Workaround for synchronization bug. Still broken on dom 4 ranks.
elliottslaughter Oct 15, 2019
b4b2bcf
Switch to a different structure, WAR dependencies on tasks. DOM is no…
elliottslaughter Oct 16, 2019
e38f3a4
Fix for dom on 1 rank, still failing multiple ranks.
elliottslaughter Oct 16, 2019
60502ba
Fix dom multiple ranks. Still unhappy on fft, random.
elliottslaughter Oct 16, 2019
dad10ee
Fixes for FFT.
elliottslaughter Oct 16, 2019
4aaa1de
Fixes for the core to accept dsets for negative timesteps.
elliottslaughter Oct 16, 2019
3e6ad5e
Clean up debug prints.
elliottslaughter Oct 16, 2019
34196eb
We don't actually use the segment so there's no need to attach it....
elliottslaughter Oct 16, 2019
dfd0a82
Switch to GASNet seq library.
elliottslaughter Oct 16, 2019
0936342
Fetch the Task Bench version of GASNet.
elliottslaughter Oct 16, 2019
8a75a2a
Bump copyright year.
elliottslaughter Mar 3, 2020
c3d3992
Work on new version of GASNet implementation.
elliottslaughter Mar 5, 2020
e78c8a3
Checkpoint working code.
elliottslaughter Mar 5, 2020
420c254
Checkpoint with more fixes, non-deterministic freeze on DOM multi-node.
elliottslaughter Mar 5, 2020
164c91c
Fix for queueing on WAR dependencies.
elliottslaughter Mar 5, 2020
05a58ca
Cleanup.
elliottslaughter Mar 5, 2020
1b55805
Avoid unnecessary work.
elliottslaughter Mar 5, 2020
98943e2
Forgot to add file.
elliottslaughter Mar 5, 2020
4a3632c
Run two iters.
elliottslaughter Mar 5, 2020
c262a51
Set default on Crays back to static linking.
elliottslaughter Mar 6, 2020
4a48afe
Flush when printing report.
elliottslaughter Mar 9, 2020
8cc0bc6
Barrier on GASNet exit.
elliottslaughter Mar 9, 2020
c404087
Initial work on AM Long implementation.
elliottslaughter Mar 9, 2020
7686b25
Fixes for AM Long implementation.
elliottslaughter Mar 10, 2020
cc3a28a
Update .gitignore.
elliottslaughter Mar 10, 2020
690ab32
Workaround for low probability freeze in GASNet.
elliottslaughter Mar 20, 2020
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ env:
matrix:
- TASKBENCH_USE_MPI=1
- USE_MPI_OPENMP=1
- TASKBENCH_USE_GASNET=1 GASNET_DEBUG=1 CONDUIT=mpi
- USE_LEGION=1 # USE_GASNET=1 CONDUIT=mpi
- USE_PYGION=1
- USE_REGENT=1
Expand Down
12 changes: 11 additions & 1 deletion build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ else
fi
THREADS=${THREADS:-$DEFAULT_THREADS}

# On Cray machines, default to static build. (Cori switched this
# default from static to dynamic in the January 2020 maintenance
# cycle, but we want to stick with static builds.)
export CRAYPE_LINK_TYPE=static

make -C core clean
make -C core -j$THREADS

Expand Down Expand Up @@ -47,10 +52,15 @@ if [[ $USE_MPI_OPENMP -eq 1 ]]; then
)
fi

if [[ $USE_GASNET -eq 1 ]]; then
if [[ $USE_GASNET -eq 1 || $TASKBENCH_USE_GASNET -eq 1 ]]; then
make -C "$GASNET_DIR"
fi

if [[ $TASKBENCH_USE_GASNET -eq 1 ]]; then
make -C gasnet clean
make -C gasnet -j$THREADS
fi

if [[ $TASKBENCH_USE_HWLOC -eq 1 ]]; then
pushd "$HWLOC_SRC_DIR"
if [[ ! -d build ]]; then
Expand Down
18 changes: 16 additions & 2 deletions core/core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,26 @@ long TaskGraph::dependence_set_at_timestep(long timestep) const
case DependenceType::TREE:
return 0;
case DependenceType::FFT:
return (timestep + max_dependence_sets() - 1) % max_dependence_sets();
{
long dset = (timestep - 1) % max_dependence_sets();
if (dset < 0) {
dset += max_dependence_sets();
}
return dset;
}
case DependenceType::ALL_TO_ALL:
case DependenceType::NEAREST:
return 0;
case DependenceType::SPREAD:
case DependenceType::RANDOM_NEAREST:
case DependenceType::RANDOM_SPREAD:
return timestep % max_dependence_sets();
{
long dset = timestep % max_dependence_sets();
if (dset < 0) {
dset += max_dependence_sets();
}
return dset;
}
default:
assert(false && "unexpected dependence type");
};
Expand Down Expand Up @@ -1174,4 +1186,6 @@ void App::report_timing(double elapsed_seconds) const
#ifdef DEBUG_CORE
printf("Task Graph Execution Mask %llx\n", has_executed_graph.load());
#endif

fflush(stdout);
}
2 changes: 2 additions & 0 deletions gasnet/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/seq
/seq_long
33 changes: 33 additions & 0 deletions gasnet/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
MPICXX ?= mpicxx

DEBUG ?= 0

CXXFLAGS ?=
CXXFLAGS += -std=c++11 -I../core
CXXFLAGS += $(shell PKG_CONFIG_PATH="$(GASNET)/lib/pkgconfig" pkg-config gasnet-$(CONDUIT)-seq --cflags)

LDFLAGS ?=
LDFLAGS += -L../core -lcore_s
LDFLAGS += $(shell PKG_CONFIG_PATH="$(GASNET)/lib/pkgconfig" pkg-config gasnet-$(CONDUIT)-seq --libs)

ifeq ($(strip $(DEBUG)),0)
CXXFLAGS += -O3
else
CXXFLAGS += -O0 -ggdb -DBOUNDS_CHECKS
endif

include ../core/make_blas.mk

BIN := seq seq_long

HEADERS := multi_dimensional_array.h

.PHONY: all
all: $(BIN)

$(BIN): %:%.cc $(HEADERS)
$(MPICXX) -o $@ $(CXXFLAGS) $< $(LDFLAGS)

.PHONY: clean
clean:
rm -f *.o $(BIN)
248 changes: 248 additions & 0 deletions gasnet/multi_dimensional_array.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
/* Copyright 2020 Stanford University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef MULTI_DIMENSIONAL_ARRAY_H
#define MULTI_DIMENSIONAL_ARRAY_H

#include <cassert>
#include <cstdio>

#include <algorithm>
#include <initializer_list>

// #define BOUNDS_CHECKS
// #define MAIN

template <size_t N, typename T>
class Array {
public:
Array()
: data(nullptr)
{
}

Array(std::initializer_list<size_t> ext)
{
assert(ext.size() == N);
std::copy(ext.begin(), ext.end(), extent);

compute_total_extent();
data = new T[total_extent];
owned = true;
}

Array(T *ptr, std::initializer_list<size_t> ext)
{
assert(ext.size() == N);
std::copy(ext.begin(), ext.end(), extent);

compute_total_extent();
data = ptr;
owned = false;
}

Array(const Array<N, T> &array)
{
std::copy(array.extent, array.extent+N, extent);
total_extent = array.total_extent;

if (array.owned) {
data = new T[total_extent];
std::copy(array.begin(), array.end(), begin());
} else {
data = array.data;
}
owned = array.owned;
}

Array<N, T> & operator=(const Array<N, T> &array) {
destroy();

extent = array.extent;
total_extent = array.total_extent;

if (array.owned) {
data = new T[total_extent];
std::copy(array.begin(), array.end(), begin());
} else {
data = array.data;
}
owned = array.owned;

return *this;
}

~Array()
{
destroy();
}

void resize(std::initializer_list<size_t> ext)
{
destroy();

assert(ext.size() == N);
std::copy(ext.begin(), ext.end(), extent);

compute_total_extent();
data = new T[total_extent];
owned = true;
}

void resize(T *ptr, std::initializer_list<size_t> ext)
{
destroy();

assert(ext.size() == N);
std::copy(ext.begin(), ext.end(), extent);

compute_total_extent();
data = ptr;
owned = false;
}

size_t size() const
{
return total_extent;
}

bool empty() const
{
return size() == 0;
}

T * begin()
{
return data;
}

const T * begin() const
{
return data;
}

T * end()
{
return data + total_extent;
}

const T * end() const
{
return data + total_extent;
}

template <typename... IDX, typename std::enable_if<sizeof...(IDX) == N, int>::type = 0>
T & operator() (IDX... idx)
{
#ifdef BOUNDS_CHECKS
check(idx...);
#endif
size_t lin = linearize(idx...);
#ifdef BOUNDS_CHECKS
assert(lin < total_extent);
#endif
return data[lin];
}

private:
void compute_total_extent()
{
total_extent = 1;
for (size_t dim = 0; dim < N; dim++) {
total_extent *= extent[dim];
}
}

void destroy()
{
if (data && owned)
delete [] data;
}

private:
template <typename FIRST>
void check(FIRST first) {
const size_t DIM = N-1;

assert((size_t) first >= 0 && (size_t) first < extent[DIM]);
}

template <typename FIRST, typename... REST>
void check(FIRST first, REST... rest) {
const size_t DIM = N - sizeof...(REST) - 1;

assert((size_t) first >= 0 && (size_t) first < extent[DIM]);

check(rest...);
}

template <typename FIRST>
size_t linearize(size_t acc, FIRST first) {
const size_t DIM = N-1;

return first + acc * extent[DIM];
}

template <typename FIRST, typename... REST>
size_t linearize(size_t acc, FIRST first, REST... rest) {
const size_t DIM = N - sizeof...(REST) - 1;

return linearize(first + acc * extent[DIM], rest...);
}

size_t extent[N];
size_t total_extent;
T *data;
bool owned;
};

#ifdef MAIN
int main() {
Array<5, int> a({2, 3, 4, 5, 6});
Array<3, float> b({1, 2, 3});
Array<2, double> c({1, 2});

for (int i = 0; i < 2; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 4; k++) {
for (int l = 0; l < 5; l++) {
for (int m = 0; m < 6; m++) {
a(i, j, k, l, m) = i*j*k*l*m;
}
}
}
}
}

for (int i = 0; i < 2; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 4; k++) {
for (int l = 0; l < 5; l++) {
for (int m = 0; m < 6; m++) {
assert(a(i, j, k, l, m) == i*j*k*l*m);
}
}
}
}
}

// varies most quickly in the first dimension
assert(&a(0, 0, 0, 0, 1) - &a(0, 0, 0, 0, 0) == 1);

return 0;
}
#endif

#endif // MULTI_DIMENSIONAL_ARRAY_H
Loading