Skip to content

Commit

Permalink
Merge pull request #105 from dash-project/bug-3-mat-row-copy
Browse files Browse the repository at this point in the history
Fixes in slicing of Matrix view specifiers
  • Loading branch information
fuchsto authored Nov 15, 2016
2 parents 8d915e5 + 3fcf718 commit d95c34b
Show file tree
Hide file tree
Showing 16 changed files with 358 additions and 194 deletions.
2 changes: 1 addition & 1 deletion dart-impl/base/include/dash/dart/base/locality.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static inline
dart_ret_t dart__base__locality__destruct_domain(
dart_domain_locality_t * domain)
{
int ret = dart__base__locality__domain__destruct(domain);
dart_ret_t ret = dart__base__locality__domain__destruct(domain);
if (ret != DART_OK) { return ret; }
free(domain);
return DART_OK;
Expand Down
23 changes: 12 additions & 11 deletions dash/examples/bench.01.igups/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,17 @@ int main(int argc, char * argv[])

std::deque<std::pair<int, int>> tests;

tests.push_back({0 , 0}); // this prints the header
tests.push_back({0 , 0}); // this prints the header
tests.push_back({4 , 100000});
tests.push_back({16 , 10000});
tests.push_back({64 , 10000});
tests.push_back({256 , 10000});
tests.push_back({1024 , 1000});
tests.push_back({4096 , 1000});
tests.push_back({4 * 4096 , 100});
tests.push_back({16 * 4096 , 100});
tests.push_back({64 * 4096 , 50});
tests.push_back({16 , 10000});
tests.push_back({64 , 10000});
tests.push_back({256 , 10000});
tests.push_back({1024 , 1000});
tests.push_back({4096 , 1000});
tests.push_back({4 * 4096 , 100});
tests.push_back({16 * 4096 , 100});
tests.push_back({64 * 4096 , 50});
tests.push_back({128 * 4096 , 20});

for (auto test : tests) {
perform_test(test.first, test.second);
Expand Down Expand Up @@ -446,11 +447,11 @@ double test_raw_array(
}
auto time_elapsed = timer.Elapsed();

delete[] arr;

validate(
arr, arr + ELEM_PER_UNIT,
ELEM_PER_UNIT, REPEAT);

delete[] arr;
return time_elapsed;
}

84 changes: 34 additions & 50 deletions dash/examples/bench.04.histo-tf/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ typedef dash::util::Timer<
// https://www.nas.nasa.gov/assets/pdf/techreports/1994/rnr-94-007.pdf

// NOTE:
// In the NBP reference implementation, keys are first sorted to buckets to
// determine their coarse distribution.
// In the NBP reference implementation, keys are first sorted to buckets
// to determine their coarse distribution.
// For example, for key range (0, 2^23) and buckset size s_b = 2^10, a
// histogram with n_b = 2^(23-10) = 2^13 bins of size 2^10 = 1024 is created
// so that bucket[b] holds the number of keys with values between (b * s_b)
// and ((b+1) * s_b).
// histogram with n_b = 2^(23-10) = 2^13 bins of size 2^10 = 1024 is
// created so that bucket[b] holds the number of keys with values
// between (b * s_b) and ((b+1) * s_b).

#if defined(DASH__BENCH__HISTO__CLASS_A)
# define TOTAL_KEYS_LOG_2 23
Expand All @@ -40,8 +40,8 @@ typedef dash::util::Timer<
# define SEED 314159265
#else
// Debug configuration
# define TOTAL_KEYS_LOG_2 23
# define MAX_KEY_LOG_2 21
# define TOTAL_KEYS_LOG_2 29
# define MAX_KEY_LOG_2 22
# define NUM_BUCKETS_LOG_2 3
# define I_MAX 1
# define SEED 314159265
Expand All @@ -63,11 +63,6 @@ int main(int argc, char **argv)
{
dash::init(&argc, &argv);

bool verbose = false;
if (argc > 1 && std::string(argv[1]) == "-v") {
verbose = true;
}

Timer::Calibrate(0);

int myid = dash::myid();
Expand All @@ -89,7 +84,7 @@ int main(int argc, char **argv)
// result histograms, one per unit
dash::Array<int> key_histo(MAX_KEY * num_units, dash::BLOCKED);

// PROCEDURE STEP 1 --------------------------------------------------------
// PROCEDURE STEP 1 ----------------------------------------------------
// "In a scalar sequential manner and using the key generation algorithm
// described above, generate the sequence of N keys."
//
Expand All @@ -113,42 +108,38 @@ int main(int argc, char **argv)
key_array.local[l] = k * x;
}

// PROCEDURE STEP 2 --------------------------------------------------------
// "Using the appropriate memory mapping described above, load the N keys
// into the memory system."
// PROCEDURE STEP 2 ----------------------------------------------------
// "Using the appropriate memory mapping described above, load the
// N keys into the memory system."
//

if (myid == 0) {
cout << "Number of keys: " << key_array.size()
cout << std::setw(25) << "Number of keys: "
<< std::setw(18) << key_array.size()
<< endl
<< "Max key: " << MAX_KEY
<< std::setw(25) << "Max key: "
<< std::setw(18) << MAX_KEY
<< endl;
if (verbose) {
for (size_t i = 0; i < std::min<size_t>(200, key_array.size()); i++) {
cout << key_array[i] << " ";
}
cout << endl;
}
}

// Wait for initialization of input values:
dash::barrier();

// PROCEDURE STEP 3 --------------------------------------------------------
// PROCEDURE STEP 3 ----------------------------------------------------
// "Begin timing."
//
auto ts_start = Timer::Now();

// PROCEDURE STEP 4 --------------------------------------------------------
// PROCEDURE STEP 4 ----------------------------------------------------
// "Do, for i = 1 to I_max"
//
// PROCEDURE STEP 4.a ------------------------------------------------------
// PROCEDURE STEP 4.a --------------------------------------------------
// "Modify the sequence of keys by making the following two changes:
// - K[i] <- i
// - K[i + I_max] <- B_max - i"
//

// PROCEDURE STEP 4.b ------------------------------------------------------
// PROCEDURE STEP 4.b --------------------------------------------------
// "Compute the rank of each key."
//

Expand All @@ -166,8 +157,8 @@ int main(int argc, char **argv)
key_histo.begin(), // C = plus(A,B)
dash::plus<int>());
}
// Wait for all units to accumulate their local results to local histogram
// of unit 0:
// Wait for all units to accumulate their local results to local
// histogram of unit 0:
dash::barrier();

if (dash::myid() != 0) {
Expand All @@ -180,28 +171,19 @@ int main(int argc, char **argv)
// Wait for all units to obtain the result histogram:
dash::barrier();

// PROCEDURE STEP 5 --------------------------------------------------------
// PROCEDURE STEP 5 ----------------------------------------------------
// "End timing."
//

auto time_elapsed_usec = Timer::ElapsedSince(ts_start);
auto mkeys_per_sec = static_cast<double>(TOTAL_KEYS) /
time_elapsed_usec;
if (verbose && myid == 0) {
cout << "Histogram size: " << key_histo.local.size()
<< endl
<< "------------------------"
<< endl;
for(size_t i = 0; i < key_histo.local.size(); ++i) {
cout << std::setw(5) << i << ": " << key_histo.local[i]
<< endl;
}
}

if (myid == 0) {
cout << "------------------------"
cout << "-------------------------------------------"
<< endl
<< "MKeys/sec: " << mkeys_per_sec
<< std::setw(25) << "MKeys/sec: "
<< std::setw(18) << mkeys_per_sec
<< endl;
}

Expand All @@ -211,7 +193,8 @@ int main(int argc, char **argv)
}

/**
* Implementation from NAS Parallel Benchmark MPI implementation of Kernel IS.
* Implementation from NAS Parallel Benchmark MPI implementation of
* Kernel IS.
*
* See NBP3.3-MPI/IS/is.c
*/
Expand Down Expand Up @@ -269,7 +252,8 @@ double randlc(double * X, double * A)
}

/**
* Implementation from NAS Parallel Benchmark MPI implementation of Kernel IS.
* Implementation from NAS Parallel Benchmark MPI implementation of
* Kernel IS.
*
* See NBP3.3-MPI/IS/is.c
*
Expand All @@ -279,11 +263,11 @@ double randlc(double * X, double * A)
* number which is the first random number for the subsequence belonging
* to processor rank kn, and which is used as seed for proc kn ran # gen.
*/
double find_my_seed(int kn, /* my processor rank, 0<=kn<=num procs */
int np, /* np = num procs */
long nn, /* total num of ran numbers, all procs */
double s, /* Ran num seed, for ex.: 314159265.00 */
double a) /* Ran num gen mult, try 1220703125.00 */
double find_my_seed(int kn, /* my processor rank, 0<=kn<=num procs */
int np, /* np = num procs */
long nn, /* total num of ran numbers, all procs */
double s, /* Ran num seed, for ex.: 314159265.00 */
double a) /* Ran num gen mult, try 1220703125.00 */
{
long i;
double t1,t2,t3,an;
Expand Down
4 changes: 2 additions & 2 deletions dash/examples/bench.04.histo/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
using std::cout;
using std::endl;

#define NUM_KEYS (1<<23)
#define MAX_KEY (1<<13)
#define NUM_KEYS (1<<29)
#define MAX_KEY (1<<22)

/*
#define NUM_KEYS 32
Expand Down
Loading

0 comments on commit d95c34b

Please sign in to comment.