Skip to content

Commit

Permalink
Merge pull request #584 from jjwilke/add-motif-skeletons
Browse files Browse the repository at this point in the history
added more skeletons (and testing fixes)
  • Loading branch information
jjwilke authored Oct 23, 2020
2 parents a37691f + a3f6a97 commit 9cc1c48
Show file tree
Hide file tree
Showing 17 changed files with 1,309 additions and 2 deletions.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ AC_CONFIG_FILES([bin/sstcc], [chmod +x bin/sstcc])
AC_CONFIG_FILES([bin/sstccvars.py])
AC_CONFIG_FILES([tests/runtest], [chmod +x tests/runtest])
AC_CONFIG_FILES([tests/checktest], [chmod +x tests/checktest])
AC_CONFIG_FILES([tests/checkdiff], [chmod +x tests/checkdiff])

AC_OUTPUT

Expand Down
3 changes: 3 additions & 0 deletions sstmac/skeletons/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ nobase_library_include_HEADERS = \
libsstmac_skeletons_la_LDFLAGS =

libsstmac_skeletons_la_SOURCES = \
fft/fft.cc \
halo3d-26/halo3d-26.cc \
sweep3d/sweep3d.cc \
traffic_matrix/main.cc \
undumpi/parsedumpi.cc \
undumpi/parsedumpi_callbacks.cc
Expand Down
178 changes: 178 additions & 0 deletions sstmac/skeletons/fft/fft.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
/**
Copyright 2009-2020 National Technology and Engineering Solutions of Sandia,
LLC (NTESS). Under the terms of Contract DE-NA-0003525, the U.S. Government
retains certain rights in this software.
Sandia National Laboratories is a multimission laboratory managed and operated
by National Technology and Engineering Solutions of Sandia, LLC., a wholly
owned subsidiary of Honeywell International, Inc., for the U.S. Department of
Energy's National Nuclear Security Administration under contract DE-NA0003525.
Copyright (c) 2009-2020, NTESS
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Questions? Contact [email protected]
*/
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include <sstmac/replacements/mpi.h>

#define MP_X 0
#define MP_Y 1
#define MP_Z 2

#define calc_pe(a,b,c) ((a)+(b)*dims[MP_X]+(c)*dims[MP_X]*dims[MP_Y])

#define sstmac_app_name fft
int USER_MAIN(int argc, char **argv)
{
int world_rank, numranks;
MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD,&world_rank);
MPI_Comm_size(MPI_COMM_WORLD,&numranks);

int myrank = world_rank;
MPI_Comm comm = MPI_COMM_WORLD;

int dims[3] = {0, 0, 0};

int msg_size_x = 0;
int msg_size_y = 0;
int msg_size_z = 0;
int MAX_ITER = 10;
int print = 0;

for (int i = 0; i < argc; ++i) {
if (strcmp("-pex", argv[i]) == 0) {
dims[MP_X] = atoi(argv[i + 1]);
i++;
} else if (strcmp("-pey", argv[i]) == 0) {
dims[MP_Y] = atoi(argv[i + 1]);
i++;
} else if (strcmp("-pez", argv[i]) == 0) {
dims[MP_Z] = atoi(argv[i + 1]);
i++;
} else if (strcmp("-iterations", argv[i]) == 0) {
MAX_ITER = atoi(argv[i + 1]);
i++;
} else if (strcmp("-nx", argv[i]) == 0) {
msg_size_x = atoi(argv[i + 1]);
i++;
} else if (strcmp("-ny", argv[i]) == 0) {
msg_size_y = atoi(argv[i + 1]);
i++;
} else if (strcmp("-nz", argv[i]) == 0) {
msg_size_z = atoi(argv[i + 1]);
i++;
} else if (strcmp(argv[i], "-print") == 0){
print = atol(argv[i+1]);
++i;
}
}

if(dims[MP_X] * dims[MP_Y] * dims[MP_Z] != numranks) {
fprintf(stderr, "\n nx * ny * nz does not equal number of ranks\n");
MPI_Abort(MPI_COMM_WORLD, 1);
}

//figure out my coordinates
int myXcoord = myrank % dims[MP_X];
int myYcoord = (myrank % (dims[MP_X] * dims[MP_Y])) / dims[MP_X];
int myZcoord = (myrank % (dims[MP_X] * dims[MP_Y] * dims[MP_Z])) / (dims[MP_X] * dims[MP_Y]);

bool skip[3];

//which a2as to skip
skip[MP_X] = msg_size_x == 0;
skip[MP_Y] = msg_size_y == 0;
skip[MP_Z] = msg_size_z == 0;

//all a2a share the buffer
int largestMsg = (msg_size_x * dims[MP_X] > msg_size_y * dims[MP_Y]) ? msg_size_x * dims[MP_X] : msg_size_y * dims[MP_Y];
largestMsg = (largestMsg > msg_size_z * dims[MP_Z]) ? largestMsg : msg_size_z * dims[MP_Z];

char *sendbuf = nullptr;
char *recvbuf = nullptr;

//create subcommunicators
MPI_Comm X_comm, Y_comm, Z_comm;
if(!skip[MP_X]) {
MPI_Comm_split(comm, myZcoord * dims[MP_Y] + myYcoord, myXcoord, &X_comm);
}
if(!skip[MP_Y]) {
MPI_Comm_split(comm, myZcoord * dims[MP_X] + myXcoord, myYcoord, &Y_comm);
}
if(!skip[MP_Z]) {
MPI_Comm_split(comm, myYcoord * dims[MP_X] + myXcoord, myZcoord, &Z_comm);
}

double startTime, stopTime;
MPI_Barrier(MPI_COMM_WORLD);

startTime = MPI_Wtime();
for (int i = 0; i < MAX_ITER; i++) {
double start = MPI_Wtime();
if(!skip[MP_X]) {
MPI_Alltoall(sendbuf, msg_size_x, MPI_CHAR, recvbuf, msg_size_x, MPI_CHAR, X_comm);
}

if(!skip[MP_Y]) {
MPI_Alltoall(sendbuf, msg_size_y, MPI_CHAR, recvbuf, msg_size_y, MPI_CHAR, Y_comm);
}

if(!skip[MP_Z]) {
MPI_Alltoall(sendbuf, msg_size_z, MPI_CHAR, recvbuf, msg_size_z, MPI_CHAR, Z_comm);
}

double stop = MPI_Wtime();
if (print){
printf("Rank %d = [%d,%d,%d] iteration %d: %12.8fs\n",
myrank, myXcoord, myYcoord, myZcoord, i, (stop-start));
}
}

MPI_Barrier(MPI_COMM_WORLD);
stopTime = MPI_Wtime();


//finalized summary output
if(myrank == 0 && MAX_ITER != 0 && print) {
printf("Finished %d iterations\n",MAX_ITER);
printf("Time elapsed per iteration for grid size (%d,%d,%d) with message sizes (%d,%d,%d) : %f s\n",
dims[MP_X], dims[MP_Y], dims[MP_Z], msg_size_x, msg_size_y, msg_size_z, (stopTime - startTime)/MAX_ITER);
}

MPI_Finalize();
return 0;
}


59 changes: 59 additions & 0 deletions sstmac/skeletons/fft/parameters.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

node {
app1 {
indexing = block
allocation = first_available
name = fft
launch_cmd = aprun -n 64 -N 1
argv = -pex 4 -pey 4 -pez 4 -nx 3200 -ny 3200 -nz 3200 -iterations 3 -print 1
}
nic {
name = snappr
injection {
mtu = 1KB
bandwidth = 10GB/s
latency = 1us
credits = 64KB
}
}
memory {
name = snappr
channel_bandwidth = 10GB/s
num_channels = 8
mtu = 1MB
latency = 15ns
}
proc {
ncores = 4
frequency = 2.1Ghz
}
name = simple
}

switch {
name = snappr
arbitrator = fifo
mtu = 1KB
link {
bandwidth = 2.5GB/s
latency = 100ns
credits = 64KB
}
logp {
bandwidth = 2.5GB/s
out_in_latency = 1us
hop_latency = 100ns
}
router {
name = torus_minimal
}
}


topology {
name = torus
seed = 14
geometry = [4,4,4]
redundant = [8,4,8]
concentration = 1
}
Loading

0 comments on commit 9cc1c48

Please sign in to comment.