Commit df4a02be authored by Neil McGlohon's avatar Neil McGlohon

Merge branch 'dfp-online-workloads' into 'master'

# Conflicts:
#   src/network-workloads/model-net-mpi-replay.c
#   src/networks/model-net/dragonfly-custom.C
parents e481d3ec 4bf55ecf
......@@ -13,6 +13,8 @@ EXTRA_PROGRAMS =
CLEANFILES = $(bin_SCRIPTS)
EXTRA_DIST =
BUILT_SOURCES =
AM_LDFLAGS =
# pkgconfig files
pkgconfigdir = $(libdir)/pkgconfig
......@@ -57,6 +59,12 @@ AM_CPPFLAGS += ${RECORDER_CPPFLAGS}
src_libcodes_la_SOURCES += src/workload/methods/codes-recorder-io-wrkld.c
endif
if USE_ONLINE
AM_CPPFLAGS += ${ARGOBOTS_CFLAGS} ${SWM_CFLAGS} -DUSE_ONLINE=1
LDADD += ${SWM_LIBS} ${ARGOBOTS_LIBS}
src_libcodes_la_SOURCES += src/workload/methods/codes-online-comm-wrkld.C
endif
if USE_DUMPI
AM_CPPFLAGS += ${DUMPI_CFLAGS} -DUSE_DUMPI=1
src_libcodes_la_SOURCES += src/workload/methods/codes-dumpi-trace-nw-wrkld.c
......
......@@ -19,6 +19,9 @@ extern "C" {
#include <ross.h>
#include "configuration.h"
#ifdef USE_ONLINE
#include <abt.h>
#endif
#define MAX_NAME_LENGTH_WKLD 512
/* implementations included with codes */
......@@ -30,6 +33,7 @@ typedef struct recorder_params recorder_params;
/* struct to hold the actual data from a single MPI event*/
typedef struct dumpi_trace_params dumpi_trace_params;
typedef struct checkpoint_wrkld_params checkpoint_wrkld_params;
typedef struct online_comm_params online_comm_params;
struct iomock_params
{
......@@ -77,6 +81,11 @@ struct dumpi_trace_params {
#endif
};
struct online_comm_params {
char workload_name[MAX_NAME_LENGTH_WKLD];
char file_path[MAX_NAME_LENGTH_WKLD];
int nprocs;
};
struct checkpoint_wrkld_params
{
int nprocs; /* number of workload processes */
......@@ -218,14 +227,14 @@ struct codes_workload_op
} collective;
struct {
int count;
unsigned int* req_ids;
uint32_t* req_ids;
} waits;
struct {
unsigned int req_id;
uint32_t req_id;
} wait;
struct
{
unsigned int req_id;
uint32_t req_id;
}
free;
}u;
......@@ -306,6 +315,13 @@ int codes_workload_get_rank_cnt(
const char* params,
int app_id);
/* Finalize the workload */
int codes_workload_finalize(
const char* type,
const char* params,
int app_id,
int rank);
/* for debugging/logging: print an individual operation to the specified file */
void codes_workload_print_op(
FILE *f,
......@@ -324,6 +340,7 @@ struct codes_workload_method
void (*codes_workload_get_next)(int app_id, int rank, struct codes_workload_op *op);
void (*codes_workload_get_next_rc2)(int app_id, int rank);
int (*codes_workload_get_rank_cnt)(const char* params, int app_id);
int (*codes_workload_finalize)(const char* params, int app_id, int rank);
};
......
......@@ -9,6 +9,7 @@
*/
#include <map>
#include <vector>
#include <set>
#include "codes/codes.h"
#include "codes/model-net.h"
......@@ -23,8 +24,8 @@ using namespace std;
enum ConnectionType
{
CONN_LOCAL = 1,
CONN_GLOBAL,
CONN_TERMINAL
CONN_GLOBAL = 2,
CONN_TERMINAL = 3
};
/**
......@@ -42,6 +43,11 @@ struct Connection
ConnectionType conn_type; //type of the connection: CONN_LOCAL, CONN_GLOBAL, or CONN_TERMINAL
};
inline bool operator<(const Connection& lhs, const Connection& rhs)
{
return lhs.port < rhs.port;
}
/**
* @class ConnectionManager
*
......@@ -69,6 +75,12 @@ class ConnectionManager {
map< int, Connection > _portMap; //Mapper for ports to connections
vector< int > _other_groups_i_connect_to;
set< int > _other_groups_i_connect_to_set;
map< int, vector< Connection > > _connections_to_groups_map; //maps group ID to connections to said group
map< int, vector< Connection > > _all_conns_by_type_map;
// map< int, vector< Connection > > intermediateRouterToGroupMap; //maps group id to list of routers that connect to it.
// //ex: intermediateRouterToGroupMap[3] returns a vector
// //of connections from this router to routers that have
......@@ -191,6 +203,17 @@ public:
*/
vector< Connection > get_connections_by_type(ConnectionType type);
/**
* @brief returns a vector of all group IDs that the router has a global connection to
* @note this does not include the router's own group as that is a given
*/
vector< int > get_connected_group_ids();
/**
*
*/
void solidify_connections();
/**
* @brief prints out the state of the connection manager
*/
......@@ -255,6 +278,9 @@ void ConnectionManager::add_connection(int dest_gid, ConnectionType type)
// TW_ERROR(TW_LOC, "add_connection(dest_id, type): Undefined connection type\n");
}
if(conn.dest_group_id != conn.src_group_id)
_other_groups_i_connect_to_set.insert(conn.dest_group_id);
_portMap[conn.port] = conn;
}
......@@ -393,46 +419,90 @@ vector< Connection > ConnectionManager::get_connections_to_gid(int dest_gid, Con
vector< Connection > ConnectionManager::get_connections_to_group(int dest_group_id)
{
vector< Connection > conns_to_group;
return _connections_to_groups_map[dest_group_id];
}
map< int, vector< Connection > >::iterator it = globalConnections.begin();
for(; it != globalConnections.end(); it++) //iterate over each router that is connected to source
{
vector< Connection >::iterator conns_to_router;
for(conns_to_router = (it->second).begin(); conns_to_router != (it->second).end(); conns_to_router++) //iterate over each connection to a specific router
vector< Connection > ConnectionManager::get_connections_by_type(ConnectionType type)
{
switch (type)
{
if ((*conns_to_router).dest_group_id == dest_group_id) {
conns_to_group.push_back(*conns_to_router);
}
case CONN_LOCAL:
return _all_conns_by_type_map[CONN_LOCAL];
break;
case CONN_GLOBAL:
return _all_conns_by_type_map[CONN_GLOBAL];
break;
case CONN_TERMINAL:
return _all_conns_by_type_map[CONN_TERMINAL];
break;
default:
tw_error(TW_LOC, "Bad enum type\n");
}
}
return conns_to_group;
}
vector< Connection > ConnectionManager::get_connections_by_type(ConnectionType type)
vector< int > ConnectionManager::get_connected_group_ids()
{
map< int, vector< Connection > > theMap;
switch (type)
return _other_groups_i_connect_to;
}
void ConnectionManager::solidify_connections()
{
//-- other groups connect to
set< int >::iterator it;
for(it = _other_groups_i_connect_to_set.begin(); it != _other_groups_i_connect_to_set.end(); it++)
{
case CONN_LOCAL:
theMap = intraGroupConnections;
break;
case CONN_GLOBAL:
theMap = globalConnections;
break;
case CONN_TERMINAL:
theMap = terminalConnections;
break;
_other_groups_i_connect_to.push_back(*it);
}
vector< Connection > retVec;
map< int, vector< Connection > >::iterator it;
for(it = theMap.begin(); it != theMap.end(); it++)
//--connections to group
for(it = _other_groups_i_connect_to_set.begin(); it != _other_groups_i_connect_to_set.end(); it++)
{
retVec.insert(retVec.end(), (*it).second.begin(), (*it).second.end());
int dest_group_id = *it;
vector< Connection > conns_to_group;
map< int, vector< Connection > >::iterator itg = globalConnections.begin();
for(; itg != globalConnections.end(); itg++) //iterate over each router that is connected to source
{
vector< Connection >::iterator conns_to_router;
for(conns_to_router = (itg->second).begin(); conns_to_router != (itg->second).end(); conns_to_router++) //iterate over each connection to a specific router
{
if ((*conns_to_router).dest_group_id == dest_group_id) {
conns_to_group.push_back(*conns_to_router);
}
}
}
_connections_to_groups_map[dest_group_id] = conns_to_group;
}
return retVec;
//--get connections by type
map< int, vector< Connection > > theMap;
for ( int enum_int = CONN_LOCAL; enum_int != CONN_TERMINAL + 1; enum_int++ )
{
switch (enum_int)
{
case CONN_LOCAL:
theMap = intraGroupConnections;
break;
case CONN_GLOBAL:
theMap = globalConnections;
break;
case CONN_TERMINAL:
theMap = terminalConnections;
break;
default:
tw_error(TW_LOC, "Bad enum type\n");
}
vector< Connection > retVec;
map< int, vector< Connection > >::iterator it;
for(it = theMap.begin(); it != theMap.end(); it++)
{
retVec.insert(retVec.end(), (*it).second.begin(), (*it).second.end());
}
_all_conns_by_type_map[enum_int] = retVec;
}
}
......
......@@ -5,6 +5,10 @@ AC_PREREQ([2.67])
AC_INIT([codes], [0.6.0], [http://trac.mcs.anl.gov/projects/codes/newticket],[],[http://www.mcs.anl.gov/projects/codes/])
LT_INIT
#WRAP SOME OPTION AROUND THIS - IT'S NOT REQUIRED FOR 99% OF CODES
AX_BOOST_BASE([1.66])
AC_CANONICAL_TARGET
AC_CANONICAL_SYSTEM
AC_CANONICAL_HOST
......@@ -26,6 +30,7 @@ AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_CXXCPP
AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
AC_PROG_RANLIB
PKG_PROG_PKG_CONFIG
......@@ -104,6 +109,24 @@ fi
AM_CONDITIONAL(USE_DARSHAN, [test "x${use_darshan}" = xyes])
# check for Argobots
AC_ARG_WITH([online],[AS_HELP_STRING([--with-online@<:@=DIR@:>@],
[Build with the online workloads and argobots support])],
[use_online=yes],[use_online=no])
if test "x${use_online}" != "x" ; then
AM_CONDITIONAL(USE_ONLINE, true)
PKG_CHECK_MODULES_STATIC([ARGOBOTS], [argobots], [],
[AC_MSG_ERROR([Could not find working argobots installation via pkg-config])])
PKG_CHECK_MODULES_STATIC([SWM], [swm], [],
[AC_MSG_ERROR([Could not find working swm installation via pkg-config])])
PKG_CHECK_VAR([SWM_DATAROOTDIR], [swm], [datarootdir], [],
[AC_MSG_ERROR[Could not find shared directory in SWM]])
AC_DEFINE_UNQUOTED([SWM_DATAROOTDIR], ["$SWM_DATAROOTDIR"], [if using json
data files])
else
AM_CONDITIONAL(USE_ONLINE, false)
fi
# check for Recorder
AM_CONDITIONAL(USE_RECORDER, true)
RECORDER_CPPFLAGS="-DUSE_RECORDER=1"
......
This diff is collapsed.
This diff is collapsed.
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_BOOST_FILESYSTEM
#
# DESCRIPTION
#
# Test for Filesystem library from the Boost C++ libraries. The macro
# requires a preceding call to AX_BOOST_BASE. Further documentation is
# available at <http://randspringer.de/boost/index.html>.
#
# This macro calls:
#
# AC_SUBST(BOOST_FILESYSTEM_LIB)
#
# And sets:
#
# HAVE_BOOST_FILESYSTEM
#
# LICENSE
#
# Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de>
# Copyright (c) 2009 Michael Tindal
# Copyright (c) 2009 Roman Rybalko <libtorrent@romanr.info>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 27
AC_DEFUN([AX_BOOST_FILESYSTEM],
[
AC_ARG_WITH([boost-filesystem],
AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@],
[use the Filesystem library from boost - it is possible to specify a certain library for the linker
e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]),
[
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ax_boost_user_filesystem_lib=""
else
want_boost="yes"
ax_boost_user_filesystem_lib="$withval"
fi
],
[want_boost="yes"]
)
if test "x$want_boost" = "xyes"; then
AC_REQUIRE([AC_PROG_CC])
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
LIBS_SAVED=$LIBS
LIBS="$LIBS $BOOST_SYSTEM_LIB"
export LIBS
AC_CACHE_CHECK(whether the Boost::Filesystem library is available,
ax_cv_boost_filesystem,
[AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/filesystem/path.hpp>]],
[[using namespace boost::filesystem;
path my_path( "foo/bar/data.txt" );
return 0;]])],
ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no)
AC_LANG_POP([C++])
])
if test "x$ax_cv_boost_filesystem" = "xyes"; then
AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available])
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
if test "x$ax_boost_user_filesystem_lib" = "x"; then
for libextension in `ls -r $BOOSTLIBDIR/libboost_filesystem* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
[link_filesystem="no"])
done
if test "x$link_filesystem" != "xyes"; then
for libextension in `ls -r $BOOSTLIBDIR/boost_filesystem* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
[link_filesystem="no"])
done
fi
else
for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do
AC_CHECK_LIB($ax_lib, exit,
[BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
[link_filesystem="no"])
done
fi
if test "x$ax_lib" = "x"; then
AC_MSG_ERROR(Could not find a version of the library!)
fi
if test "x$link_filesystem" != "xyes"; then
AC_MSG_ERROR(Could not link against $ax_lib !)
fi
fi
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
LIBS="$LIBS_SAVED"
fi
])
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_boost_system.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_BOOST_SYSTEM
#
# DESCRIPTION
#
# Test for System library from the Boost C++ libraries. The macro requires
# a preceding call to AX_BOOST_BASE. Further documentation is available at
# <http://randspringer.de/boost/index.html>.
#
# This macro calls:
#
# AC_SUBST(BOOST_SYSTEM_LIB)
#
# And sets:
#
# HAVE_BOOST_SYSTEM
#
# LICENSE
#
# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
# Copyright (c) 2008 Michael Tindal
# Copyright (c) 2008 Daniel Casimiro <dan.casimiro@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 19
AC_DEFUN([AX_BOOST_SYSTEM],
[
AC_ARG_WITH([boost-system],
AS_HELP_STRING([--with-boost-system@<:@=special-lib@:>@],
[use the System library from boost - it is possible to specify a certain library for the linker
e.g. --with-boost-system=boost_system-gcc-mt ]),
[
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ax_boost_user_system_lib=""
else
want_boost="yes"
ax_boost_user_system_lib="$withval"
fi
],
[want_boost="yes"]
)
if test "x$want_boost" = "xyes"; then
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_BUILD])
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_CACHE_CHECK(whether the Boost::System library is available,
ax_cv_boost_system,
[AC_LANG_PUSH([C++])
CXXFLAGS_SAVE=$CXXFLAGS
CXXFLAGS=
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/system/error_code.hpp>]],
[[boost::system::error_category *a = 0;]])],
ax_cv_boost_system=yes, ax_cv_boost_system=no)
CXXFLAGS=$CXXFLAGS_SAVE
AC_LANG_POP([C++])
])
if test "x$ax_cv_boost_system" = "xyes"; then
AC_SUBST(BOOST_CPPFLAGS)
AC_DEFINE(HAVE_BOOST_SYSTEM,,[define if the Boost::System library is available])
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
LDFLAGS_SAVE=$LDFLAGS
if test "x$ax_boost_user_system_lib" = "x"; then
for libextension in `ls -r $BOOSTLIBDIR/libboost_system* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
[link_system="no"])
done
if test "x$link_system" != "xyes"; then
for libextension in `ls -r $BOOSTLIBDIR/boost_system* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
[link_system="no"])
done
fi
else
for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do
AC_CHECK_LIB($ax_lib, exit,
[BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
[link_system="no"])
done
fi
if test "x$ax_lib" = "x"; then
AC_MSG_ERROR(Could not find a version of the library!)
fi
if test "x$link_system" = "xno"; then
AC_MSG_ERROR(Could not link against $ax_lib !)
fi
fi
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
fi
])
......@@ -14,11 +14,15 @@ python_cflags=@PYTHON_CFLAGS@
python_libs=@PYTHON_LIBS@
boost_cflags=@BOOST_CFLAGS@
boost_libs=@BOOST_LIBS@
argobots_libs=@ARGOBOTS_LIBS@
argobots_cflags=@ARGOBOTS_CFLAGS@
swm_libs=@SWM_LIBS@
swm_cflags=@SWM_CFLAGS@
Name: codes-base
Description: Base functionality for CODES storage simulation
Version: @PACKAGE_VERSION@
URL: http://trac.mcs.anl.gov/projects/CODES
Requires:
Libs: -L${libdir} -lcodes ${ross_libs} ${darshan_libs} ${dumpi_libs} ${cortex_libs}
Cflags: -I${includedir} ${ross_cflags} ${darshan_cflags} ${dumpi_cflags} ${cortex_cflags}
Libs: -L${libdir} -lcodes ${ross_libs} ${argobots_libs} ${swm_libs} ${darshan_libs} ${dumpi_libs} ${cortex_libs}
Cflags: -I${includedir} ${swm_datarootdir} ${ross_cflags} ${darshan_cflags} ${swm_cflags} ${argobots_cflags} ${dumpi_cflags} ${cortex_cflags}
import sys
import random
alloc_file = 'allocation.conf'
if len(sys.argv) > 2:
alloc_file = sys.argv[2]
def contiguous_alloc(job_ranks, total_nodes):
f = open(alloc_file,'w')
......@@ -30,7 +33,6 @@ def cube_alloc(job_ranks, total_nodes):
row.append(i+offset)
layer += row
cube += layer
print "list length is", len(cube), cube
f = open('cube_allc_linear.conf','w')
for rankid in range(len(cube)):
......@@ -57,7 +59,6 @@ def permeate_alloc(job_ranks, total_nodes):
permeate_list = node_list[num_rank*permeate_area: (num_rank+1)*permeate_area]
alloc_list = random.sample(permeate_list, job_ranks[num_rank])
alloc_list.sort()
print "length of alloc list", len(alloc_list), "\n", alloc_list,"\n"
for idx in range(len(alloc_list)):
f.write("%s " % alloc_list[idx])
f.write("\n")
......@@ -70,7 +71,6 @@ def random_alloc(job_rank, total_nodes):
for rankid in range(len(job_rank)):
alloc_list = random.sample(node_list, job_rank[rankid])
node_list = [i for i in node_list if (i not in alloc_list)]
print "length of alloc list", len(alloc_list), "\n", alloc_list,"\n"
for idx in range(len(alloc_list)):
f.write("%s " % alloc_list[idx])
f.write("\n")
......@@ -110,22 +110,22 @@ def stripe_alloc(job_ranks, total_nodes):
def policy_select(plcy, job_ranks, total_nodes):
if plcy == "CONT":
print "contiguous alloction!"
print("contiguous alloction!")
contiguous_alloc(job_ranks, total_nodes)
elif plcy == "rand":
print "random allocation!"
print("random allocation!")
random_alloc(job_ranks, total_nodes)
elif plcy == "STRIPE":
print "stripe allcation!"
print("stripe allcation!")
stripe_alloc(job_ranks, total_nodes)
elif plcy == "PERMEATE":
print "permeate allocation!"
print("permeate allocation!")
permeate_alloc(job_ranks, total_nodes)
elif plcy == "CUBE":
print "cube allocation!"
print("cube allocation!")
cube_alloc(job_ranks, total_nodes)
else:
print "NOT Supported yet!"
print("NOT Supported yet!")
if __name__ == "__main__":
......@@ -139,8 +139,8 @@ if __name__ == "__main__":
f.close()
alloc_plcy = array.pop(0)
total_nodes = array.pop(0)
print alloc_plcy
print(alloc_plcy)
array = map(int, array)
print array
print(array)
policy_select(alloc_plcy, array, total_nodes)
# Copyright 2018 - Neil McGlohon
# mcglon@rpi.edu
# This was a quick script to generate a dally dragonfly topology for use with dragonfly custom model
import sys
from enum import Enum
import struct
import numpy as np
argv = sys.argv
DRYRUN = 0
if sys.version_info[0] < 3:
raise Exception("Python 3 or a more recent version is required.")
class Params(object):
def __init__(self, radix, num_conn_between_groups):
self.router_radix = radix
self.num_conn_between_groups = num_conn_between_groups
self.num_routers_per_group = int((radix + 1)/2) #a = (radix + 1)/2
self.num_hosts_per_router = int(self.num_routers_per_group // 2)
self.num_gc_per_router = int(self.num_routers_per_group // 2)
self.num_gc_per_group = self.num_gc_per_router * self.num_routers_per_group
num_gc_per_group = self.num_gc_per_router * self.num_routers_per_group
self.num_groups = int((num_gc_per_group / self.num_conn_between_groups)) + 1
self.total_routers = self.num_routers_per_group * self.num_groups
def getSummary(self):
outStr = "\nDragonfly (Dally) Network:\n"
outStr += "\tNumber of Groups: %d\n" % self.num_groups
outStr += "\tRouter Radix: %d\n" % self.router_radix
outStr += "\tNumber Routers Per Group: %d\n" % self.num_routers_per_group
outStr += "\tNumber Terminal Per Router: %d\n" % self.num_hosts_per_router
outStr += "\n"
outStr += "\tNumber GC per Router: %d\n" % self.num_gc_per_router
outStr += "\tNumber GC per Group: %d\n" % self.num_gc_per_group
outStr += "\tNumber GC between Groups: %d\n" % self.num_conn_between_groups
outStr += "\n"
outStr += "\tTotal Routers: %d\n" % self.total_routers
outStr += "\tTotal Number Terminals: %d\n" % (self.num_routers_per_group * self.num_hosts_per_router * self.num_groups)
outStr += "\t"
return outStr
def main():
global DRYRUN
if "--dryrun" in argv:
DRYRUN = 1
if(len(argv) < 5):
raise Exception("Correct usage: python %s <router_radix> <num_conn_between_groups> <intra-file> <inter-file>" % sys.argv[0])
router_radix = int(argv[1])
num_conn_between_groups = int(argv[2])
intra = open(argv[3], "wb")
inter = open(argv[4], "wb")
params = Params(router_radix, num_conn_between_groups)
print(params.getSummary())
if not DRYRUN:
global A
A = np.zeros((