...
  View open merge request
Commits (21)
......@@ -60,10 +60,19 @@ 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}
AM_CPPFLAGS += ${ARGOBOTS_CFLAGS} -DUSE_ONLINE=1
LDADD += ${ARGOBOTS_LIBS}
if USE_SWM
AM_CPPFLAGS += ${SWM_CFLAGS} -DUSE_SWM=1
LDADD += ${SWM_LIBS}
src_libcodes_la_SOURCES += src/workload/methods/codes-online-comm-wrkld.C
endif
if USE_COWG
src_libcodes_la_SOURCES += src/workload/methods/codes-conc-online-comm-wrkld.C
AM_CPPFLAGS += ${COWG_CFLAGS} ${SWM_CFLAGS} -DUSE_COWG=1
LDADD += ${COWG_LIBS} ${SWM_LIBS}
endif
endif
if USE_DUMPI
AM_CPPFLAGS += ${DUMPI_CFLAGS} -DUSE_DUMPI=1
......
......@@ -133,6 +133,9 @@ typedef struct model_net_request {
int remote_event_size;
int self_event_size;
char category[CATEGORY_NAME_MAX];
//Xin: passing app id to routers
int app_id;
} model_net_request;
/* data structure for tracking network statistics */
......
......@@ -87,6 +87,11 @@ struct terminal_custom_message
tw_stime msg_start_time;
tw_stime saved_busy_time_ross;
tw_stime saved_fin_chunks_ross;
//Yao: for counting msg app id
int app_id;
tw_stime last_received_time;
tw_stime last_sent_time;
};
#ifdef __cplusplus
......
......@@ -95,6 +95,11 @@ struct terminal_dally_message
tw_stime msg_start_time;
tw_stime saved_busy_time_ross;
tw_stime saved_fin_chunks_ross;
//Yao: for counting msg app id
int app_id;
tw_stime last_received_time;
tw_stime last_sent_time;
};
#ifdef __cplusplus
......
......@@ -109,6 +109,12 @@ struct terminal_plus_message
tw_stime msg_start_time;
tw_stime saved_busy_time_ross;
tw_stime saved_fin_chunks_ross;
//Yao: for counting msg app id
int app_id;
tw_stime last_received_time;
tw_stime last_sent_time;
};
#ifdef __cplusplus
......
......@@ -121,20 +121,48 @@ 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}" != "xno" ; then
[Build with the online workloads and argobots support])])
if test "x${with_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])])
else
AM_CONDITIONAL(USE_ONLINE, false)
fi
#check for SWM
AC_ARG_WITH([swm],[AS_HELP_STRING([--with-swm@<:@=DIR@:>@],
[location of SWM installation])])
if test "x${with_swm}" != "x" ; then
AM_CONDITIONAL(USE_SWM, true)
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])
data files])
else
AM_CONDITIONAL(USE_ONLINE, false)
AM_CONDITIONAL(USE_SWM, false)
fi
#check for COWG
AC_ARG_WITH([cowg],[AS_HELP_STRING([--with-cowg@<:@=DIR@:>@],
[location of COWG installation])])
if test "x${with_cowg}" != "x" ; then
AM_CONDITIONAL(USE_COWG, true)
PKG_CHECK_MODULES_STATIC([COWG], [cowg], [],
[AC_MSG_ERROR([Could not find working cowg installation via pkg-config])])
PKG_CHECK_VAR([COWG_DATADIR], [cowg], [datarootdir], [],
[AC_MSG_ERROR[Could not find shared directory in COWG]])
AC_DEFINE_UNQUOTED([COWG_DATADIR], ["$COWG_DATADIR"], [if using json data files])
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_COWG, false)
fi
# check for Recorder
......
......@@ -19,11 +19,16 @@ argobots_cflags=@ARGOBOTS_CFLAGS@
swm_libs=@SWM_LIBS@
swm_cflags=@SWM_CFLAGS@
swm_datarootdir=@SWM_DATAROOTDIR@
cowg_libs=@COWG_LIBS@
cowg_cflags=@COWG_CFLAGS@
cowg_datadir=@COWG_DATADIR@
conceptual_libs=@CONCEPTUAL_LIBS@
conceptual_cflags=@CONCEPTUAL_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} ${argobots_libs} ${swm_libs} ${darshan_libs} ${dumpi_libs} ${cortex_libs}
Cflags: -I${includedir} -I${swm_datarootdir} ${ross_cflags} ${darshan_cflags} ${swm_cflags} ${argobots_cflags} ${dumpi_cflags} ${cortex_cflags}
Libs: -L${libdir} -lcodes ${ross_libs} ${argobots_libs} ${swm_libs} ${cowg_libs} ${darshan_libs} ${dumpi_libs} ${cortex_libs}
Cflags: -I${includedir} -I${swm_datarootdir} -I{cowg_datadir} ${ross_cflags} ${darshan_cflags} ${swm_cflags} ${cowg_cflags} ${argobots_cflags} ${dumpi_cflags} ${cortex_cflags}
import string
import sys
import os
MPI_OPS = [ 'MPI_Send', 'MPI_Recv', 'MPI_Barrier', 'MPI_Isend', 'MPI_Irecv', 'MPI_Waitall',
'MPI_Reduce', 'MPI_Allreduce', 'MPI_Bcast', 'MPI_Alltoall', 'MPI_Alltoallv',
'MPI_Comm_size', 'MPI_Comm_rank']
LOG = [ 'logfiletmpl_default', 'ncptl_log_write', 'ncptl_log_compute_aggregates', 'ncptl_log_commit_data']
def eliminate_logging(inLines):
for idx, line in enumerate(inLines):
if 'Generate and broadcast a UUID' in line:
for i in range(1, 3):
inLines[idx+i] = "//"+inLines[idx+i]
elif 'ncptl_free (logfile_uuid)' in line:
for i in range(0, 12):
inLines[idx-i] = "//"+inLines[idx-i]
elif 'int mpiresult' in line:
for i in range(0,30):
inLines[idx+i] = "//"+inLines[idx+i]
else:
for elem in LOG:
if elem in line:
inLines[idx] = "//"+line
def eliminate_conc_init(inLines):
for idx, line in enumerate(inLines):
if 'NCPTL_RUN_TIME_VERSION' in line:
inLines[idx] = "//"+line
if 'atexit (conc_exit_handler)' in line:
inLines[idx] = "//"+line
if 'Inform the run-time library' in line:
for i in range(1, 4):
inLines[idx+i] = "//"+inLines[idx+i]
def make_static_var(inLines):
for idx, line in enumerate(inLines):
if 'Dummy variable to help mark other variables as used' in line:
inLines[idx+1]="static " + inLines[idx+1]
if 'void conc_mark_variables_used' in line:
inLines[idx]="static " + line
if '/* Program-specific variables */' in line:
start = idx+1
if '* Function declarations *' in line:
end = idx-2
for i in range(start, end):
inLines[i]="static "+inLines[i]
def manipulate_mpi_ops(inLines, program_name):
for idx, line in enumerate(inLines):
# subcomm
if 'MPI_' not in line: # not MPI
if "int main" in line:
# inLines[idx] = "static int "+program_name+"_main(int* argc, char *argv[])"
inLines[idx] = line.replace("int main", "static int "+program_name+"_main")
else:
continue
else: # MPI
if 'MPI_Init' in line:
inLines[idx] = "//"+line
elif 'MPI_Errhandler_' in line: # error handling ignored
inLines[idx] = "//"+line
elif 'mpiresult = MPI_Finalize();' in line:
inLines[idx] = "CODES_MPI_Finalize();"
inLines[idx+2] = "exitcode = 0;"
elif 'MPI_Comm_get_attr' in line:
inLines[idx] = "//"+line
else:
for ops in MPI_OPS:
if ops in line:
inLines[idx] = line.replace(ops,"CODES_"+ops)
def adding_struct(inLines, program_name):
new_struct = [ '/* fill in function pointers for this method */' ,
'struct codes_conceptual_bench '+program_name+'_bench = ' ,
'{' ,
'.program_name = "'+program_name+'",' ,
'.conceptual_main = '+program_name+'_main,' ,
'};' ]
codes_include = '#include "codes/codes-conc-addon.h"'
for idx, line in enumerate(inLines):
if "* Include files *" in line:
inLines.insert(idx-1, codes_include)
break
# adding struct at the end
for i in range(0, len(new_struct)):
inLines.append(new_struct[i])
def insert_if_not_exist(content, idx, hls):
exist = False
for i in range(idx[0], idx[1]):
if hls[i] in content:
exist = True
break
if not exist:
hls.insert(idx[0], content)
def translate_conc_to_codes(filepath, codespath):
# get program name
program_name = filepath.split("/")[-1].replace(".c","")
with open(filepath, 'r') as infile:
content = infile.read()
inLines = content.split('\n')
eliminate_logging(inLines)
eliminate_conc_init(inLines)
make_static_var(inLines)
manipulate_mpi_ops(inLines, program_name)
adding_struct(inLines, program_name)
# output program file
with open(codespath+"src/workload/conceputal-skeleton-apps/conc-"+program_name+".c","w+") as outFile:
outFile.writelines(["%s\n" % item for item in inLines])
# modify interface file
program_struct = "extern struct codes_conceptual_bench "+program_name+"_bench;\n"
program_struct_idx=[]
program_definition = " &"+program_name+"_bench,\n"
program_definition_idx=[]
with open(codespath+"src/workload/codes-conc-addon.c","r+") as header:
hls = header.readlines()
for idx, line in enumerate(hls):
if '/* list of available benchmarks begin */' in line:
program_struct_idx.append(idx+1)
elif '/* list of available benchmarks end */' in line:
program_struct_idx.append(idx)
insert_if_not_exist(program_struct, program_struct_idx, hls)
for idx, line in enumerate(hls):
if '/* default benchmarks begin */' in line:
program_definition_idx.append(idx+1)
elif '/* default benchmarks end */' in line:
program_definition_idx.append(idx)
insert_if_not_exist(program_definition, program_definition_idx, hls)
header.seek(0)
header.writelines(hls)
# modify makefile
program_compile = "src_libcodes_la_SOURCES += src/workload/conceputal-skeleton-apps/conc-"+program_name+".c\n"
program_compile_idx = []
with open(codespath+"Makefile.am","r+") as makefile:
mfls = makefile.readlines()
for idx, line in enumerate(mfls):
if "CONCEPTUAL_LIBS" in line:
program_compile_idx.append(idx+1)
break
for i in range(program_compile_idx[0], len(mfls)):
if 'endif' in mfls[i]:
program_compile_idx.append(i)
break
insert_if_not_exist(program_compile, program_compile_idx, mfls)
makefile.seek(0)
makefile.writelines(mfls)
if __name__ == "__main__":
if len(sys.argv) != 4:
print 'Need 2 arguments: 1. path to files to be converted \t2. path to CODES directory\t3. path to ncptl executable'
sys.exit(1)
os.chdir(sys.argv[1])
for benchfile in next(os.walk(sys.argv[1]))[2]: # for all files
if benchfile.lower().endswith('.ncptl'):
cfile = benchfile.replace('.ncptl','.c')
cfile = cfile.replace("-","")
os.system(sys.argv[3]+' --backend=c_mpi --no-compile '+benchfile+' --output '+cfile)
print "adding bench file: %s" % cfile
translate_conc_to_codes(sys.argv[1]+cfile, sys.argv[2])
......@@ -21,9 +21,9 @@ class Params(object):
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_router = int(self.num_routers_per_group // 2)
self.num_gc_per_router = 8
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
......@@ -117,7 +117,7 @@ def writeIntra(params,fd):
for di in range(params.num_routers_per_group):
if si is not di:
fd.write(struct.pack("3i",si,di,0)) #we don't care about the 'color', set third int (color) to 0
# print("INTRA %d %d"%(si,di))
print("INTRA %d %d"%(si,di))
for gi in range(params.num_groups): #loop over all groups becasue the intra only iterates over a single group
src_gid = getRouterGID(si, gi, params.num_routers_per_group)
......@@ -145,7 +145,7 @@ def writeInter(params ,fd):
dest_rtr_gid = getRouterGID(dest_rtr_local_id, dest_gi, params.num_routers_per_group)
fd.write(struct.pack("2i",src_rtr_gid, dest_rtr_gid))
# print("INTER %d %d"%(src_rtr_gid, dest_rtr_gid))
print("INTER %d %d"%(src_rtr_gid, dest_rtr_gid))
A[src_rtr_gid,dest_rtr_gid] += 1
......
......@@ -105,7 +105,7 @@ nobase_include_HEADERS = \
codes/net/express-mesh.h \
codes/net/torus.h \
codes/codes-mpi-replay.h \
codes/configfile.h
codes/configfile.h
#codes/codes-nw-workload.h
......
......@@ -34,11 +34,11 @@ PARAMS
#buffer size in bytes for compute node virtual channels
cn_vc_size="32768";
#bandwidth in GiB/s for local channels
local_bandwidth="2.0";
local_bandwidth="25";
# bandwidth in GiB/s for global channels
global_bandwidth="2.0";
global_bandwidth="25";
# bandwidth in GiB/s for compute node-router channels
cn_bandwidth="2.0";
cn_bandwidth="25";
# Number of row channels
num_row_chans="1";
# Number of column channels
......
This diff is collapsed.
......@@ -368,6 +368,12 @@ static model_net_event_return model_net_event_impl_base(
strncpy(r->category, category, CATEGORY_NAME_MAX-1);
r->category[CATEGORY_NAME_MAX-1]='\0';
//Xin: passing app_id to the request struct
int ptroffset;
configuration_get_value_int(&config, "PARAMS", "offset", NULL, &ptroffset);
const int *id_ptr = remote_event+ptroffset;
r->app_id = *id_ptr;
if (is_msg_params_set[MN_MSG_PARAM_START_TIME])
r->msg_start_time = start_time_param;
else
......
......@@ -68,7 +68,7 @@ static int parse_line(
buf[pos]='\0';
}
int list_cap = 8;
int list_cap = 20;
int *lst = malloc(list_cap * sizeof(*lst));
assert(lst);
int rank;
......@@ -114,7 +114,7 @@ static int jobmap_list_configure(void const * params, void ** ctx)
// job storage
lst->num_jobs = 0;
int job_cap = 8;
int job_cap = 20;
lst->rank_counts = calloc(job_cap, sizeof(*lst->rank_counts));
assert(lst->rank_counts);
lst->global_ids = calloc(job_cap, sizeof(*lst->global_ids));
......
......@@ -215,7 +215,7 @@ int main(int argc, char *argv[])
wparams = (char*)&d_params;
}
}
else if(strcmp(type, "online_comm_workload") == 0){
else if(strcmp(type, "swm_online_comm_workload") == 0 || strcmp(type, "conc_online_comm_workload") == 0){
if (n == -1){
fprintf(stderr,
"Expected \"--num-ranks\" argument for online workload\n");
......@@ -448,7 +448,7 @@ int main(int argc, char *argv[])
}
} while (op.op_type != CODES_WK_END);
if(strcmp(type, "online_comm_workload") == 0)
if(strcmp(type, "swm_online_comm_workload") == 0 || strcmp(type, "conc_online_comm_workload") == 0)
{
codes_workload_finalize(type, wparams, 0, i);
}
......
......@@ -34,9 +34,14 @@ extern struct codes_workload_method darshan_mpi_io_workload_method;
#ifdef USE_RECORDER
extern struct codes_workload_method recorder_io_workload_method;
#endif
#ifdef USE_ONLINE
extern struct codes_workload_method online_comm_workload_method;
#ifdef USE_SWM
extern struct codes_workload_method swm_online_comm_workload_method;
#endif
#ifdef USE_COWG
extern struct codes_workload_method conc_online_comm_workload_method;
#endif
extern struct codes_workload_method checkpoint_workload_method;
extern struct codes_workload_method iomock_workload_method;
......@@ -58,8 +63,11 @@ static struct codes_workload_method const * method_array_default[] =
#endif
#endif
#ifdef USE_ONLINE
&online_comm_workload_method,
#ifdef USE_SWM
&swm_online_comm_workload_method,
#endif
#ifdef USE_COWG
&conc_online_comm_workload_method,
#endif
#ifdef USE_RECORDER
&recorder_io_workload_method,
......
This diff is collapsed.
......@@ -35,17 +35,17 @@ using namespace std;
static struct qhash_table *rank_tbl = NULL;
static int rank_tbl_pop = 0;
static int total_rank_cnt = 0;
ABT_thread global_prod_thread = NULL;
ABT_xstream self_es;
double cpu_freq = 1.0;
long num_allreduce = 0;
long num_isends = 0;
long num_irecvs = 0;
long num_barriers = 0;
long num_sends = 0;
long num_recvs = 0;
long num_sendrecv = 0;
long num_waitalls = 0;
static ABT_thread global_prod_thread = NULL;
static ABT_xstream self_es;
static double cpu_freq = 1.0;
static long num_allreduce = 0;
static long num_isends = 0;
static long num_irecvs = 0;
static long num_barriers = 0;
static long num_sends = 0;
static long num_recvs = 0;
static long num_sendrecv = 0;
static long num_waitalls = 0;
//std::map<int64_t, int> send_count;
//std::map<int64_t, int> isend_count;
......@@ -950,10 +950,10 @@ static int comm_online_workload_finalize(const char* params, int app_id, int ran
}
extern "C" {
/* workload method name and function pointers for the CODES workload API */
struct codes_workload_method online_comm_workload_method =
struct codes_workload_method swm_online_comm_workload_method =
{
//.method_name =
(char*)"online_comm_workload",
(char*)"swm_online_comm_workload",
//.codes_workload_read_config =
NULL,
//.codes_workload_load =
......