Commit 0b26c309 authored by Xin Wang's avatar Xin Wang

move conceptual integration outside of CODES

parent 6630aaa7
......@@ -69,8 +69,8 @@ src_libcodes_la_SOURCES += src/workload/methods/codes-online-comm-wrkld.C
endif
if USE_CONC
src_libcodes_la_SOURCES += src/workload/methods/codes-conc-online-comm-wrkld.C
AM_CPPFLAGS += ${CONCEPTUAL_CFLAGS} -DUSE_CONC=1
LDADD += ${CONCEPTUAL_LIBS}
AM_CPPFLAGS += ${CONCEPTUAL_CFLAGS} ${COWG_CFLAGS} -DUSE_CONC=1
LDADD += ${CONCEPTUAL_LIBS} ${COWG_LIBS}
endif
endif
......
/*
* Copyright (C) 2017 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#ifndef CODES_CONC_ADDON_H
#define CODES_CONC_ADDON_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef USE_CONC
#include <ncptl/ncptl.h>
#endif
#include <mpi.h>
#define MAX_CONC_ARGV 128
typedef struct conc_bench_param conc_bench_param;
struct conc_bench_param {
char conc_program[MAX_CONC_ARGV];
int conc_argc;
char config_in[MAX_CONC_ARGV][MAX_CONC_ARGV];
char *conc_argv[MAX_CONC_ARGV];
};
int codes_conc_bench_load(
const char* program,
int argc,
char *argv[]);
void CODES_MPI_Comm_size (MPI_Comm comm, int *size);
void CODES_MPI_Comm_rank( MPI_Comm comm, int *rank );
void CODES_MPI_Finalize();
void CODES_MPI_Send(const void *buf,
int count,
MPI_Datatype datatype,
int dest,
int tag,
MPI_Comm comm);
void CODES_MPI_Recv(void *buf,
int count,
MPI_Datatype datatype,
int source,
int tag,
MPI_Comm comm,
MPI_Status *status);
void CODES_MPI_Sendrecv(const void *sendbuf,
int sendcount,
MPI_Datatype sendtype,
int dest,
int sendtag,
void *recvbuf,
int recvcount,
MPI_Datatype recvtype,
int source,
int recvtag,
MPI_Comm comm,
MPI_Status *status);
void CODES_MPI_Barrier(MPI_Comm comm);
void CODES_MPI_Isend(const void *buf,
int count,
MPI_Datatype datatype,
int dest,
int tag,
MPI_Comm comm,
MPI_Request *request);
void CODES_MPI_Irecv(void *buf,
int count,
MPI_Datatype datatype,
int source,
int tag,
MPI_Comm comm,
MPI_Request *request);
void CODES_MPI_Waitall(int count,
MPI_Request array_of_requests[],
MPI_Status array_of_statuses[]);
void CODES_MPI_Reduce(const void *sendbuf,
void *recvbuf,
int count,
MPI_Datatype datatype,
MPI_Op op,
int root,
MPI_Comm comm);
void CODES_MPI_Allreduce(const void *sendbuf,
void *recvbuf,
int count,
MPI_Datatype datatype,
MPI_Op op,
MPI_Comm comm);
void CODES_MPI_Bcast(void *buffer,
int count,
MPI_Datatype datatype,
int root,
MPI_Comm comm);
void CODES_MPI_Alltoall(const void *sendbuf,
int sendcount,
MPI_Datatype sendtype,
void *recvbuf,
int recvcount,
MPI_Datatype recvtype,
MPI_Comm comm);
void CODES_MPI_Alltoallv(const void *sendbuf,
const int *sendcounts,
const int *sdispls,
MPI_Datatype sendtype,
void *recvbuf,
const int *recvcounts,
const int *rdispls,
MPI_Datatype recvtype,
MPI_Comm comm);
/* implementation structure */
struct codes_conceptual_bench {
char *program_name; /* name of the conceptual program */
int (*conceptual_main)(int argc, char *argv[]);
};
void codes_conceptual_add_bench(struct codes_conceptual_bench const * method);
#ifdef __cplusplus
}
#endif
#endif /* CODES_CONC_ADDON_H */
......@@ -126,8 +126,6 @@ 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])])
AC_DEFINE_UNQUOTED([ONLINE_CONFIGDIR], ["$with_online"], [if using json data files,
specify config directory])
else
AM_CONDITIONAL(USE_ONLINE, false)
fi
......@@ -151,13 +149,20 @@ fi
AC_ARG_WITH([conceptual],[AS_HELP_STRING([--with-conceptual@<:@=DIR@:>@],
[location of Conceptual installation])])
if test "x${with_conceptual}" != "x" ; then
AC_CHECK_FILES([${with_conceptual}/lib/libncptl.a],
AM_CONDITIONAL(USE_CONC, true),
AC_MSG_ERROR(Could not find Conceptual libraries libncptl.a))
CONCEPTUAL_CFLAGS="-I${with_conceptual}/include"
CONCEPTUAL_LIBS="-L${with_conceptual}/lib/ -lncptl"
AC_SUBST(CONCEPTUAL_LIBS)
AC_SUBST(CONCEPTUAL_CFLAGS)
AC_CHECK_FILES([${with_conceptual}/lib/libncptl.a],
AM_CONDITIONAL(USE_CONC, true),
AC_MSG_ERROR(Could not find Conceptual libraries libncptl.a))
CONCEPTUAL_CFLAGS="-I${with_conceptual}/include"
CONCEPTUAL_LIBS="-L${with_conceptual}/lib/ -lncptl"
AC_SUBST(CONCEPTUAL_LIBS)
AC_SUBST(CONCEPTUAL_CFLAGS)
PKG_CHECK_MODULES_STATIC([COWG], [cowg], [],
[AC_MSG_ERROR([Could not find working cowg installation via pkg-config])])
PKG_CHECK_VAR([COWG_DATADIR], [cowg], [datadir], [],
[AC_MSG_ERROR[Could not find shared directory in COWG]])
AC_DEFINE_UNQUOTED([COWG_DATADIR], ["$COWG_DATADIR"], [if using json
data files])
else
AM_CONDITIONAL(USE_CONC, false)
fi
......
......@@ -19,6 +19,9 @@ 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@
......@@ -27,5 +30,5 @@ 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}
......@@ -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,8 +105,7 @@ nobase_include_HEADERS = \
codes/net/express-mesh.h \
codes/net/torus.h \
codes/codes-mpi-replay.h \
codes/configfile.h \
codes/codes-conc-addon.h
codes/configfile.h
#codes/codes-nw-workload.h
......@@ -152,7 +151,6 @@ src_libcodes_la_SOURCES = \
src/util/codes-mapping-context.c \
src/util/codes-comm.c \
src/workload/codes-workload.c \
src/workload/codes-conc-addon.c \
src/workload/methods/codes-iolang-wrkld.c \
src/workload/methods/codes-checkpoint-wrkld.c \
src/workload/methods/test-workload-method.c \
......
......@@ -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
......
......@@ -928,13 +928,13 @@ void arrive_syn_tr(nw_state * s, tw_bf * bf, nw_message * m, tw_lp * lp)
num_syn_bytes_recvd += data;
}
/* Debugging functions, may generate unused function warning */
/*static void print_waiting_reqs(uint32_t * reqs, int count)
static void print_waiting_reqs(uint32_t * reqs, int count)
{
lprintf("\n Waiting reqs: %d count", count);
int i;
for(i = 0; i < count; i++ )
lprintf(" %d ", reqs[i]);
}*/
}
static void print_msgs_queue(struct qlist_head * head, int is_send)
{
if(is_send)
......@@ -952,7 +952,7 @@ static void print_msgs_queue(struct qlist_head * head, int is_send)
}
static void print_completed_queue(tw_lp * lp, struct qlist_head * head)
{
// printf("\n Completed queue: ");
printf("\n Completed queue: ");
struct qlist_head * ent = NULL;
struct completed_requests* current = NULL;
tw_output(lp, "\n");
......@@ -1238,6 +1238,7 @@ static void codes_exec_mpi_wait_all(
print_waiting_reqs(mpi_op->u.waits.req_ids, count);
print_completed_queue(lp, &s->completed_reqs);
}*/
/* check number of completed irecvs in the completion queue */
for(i = 0; i < count; i++)
{
......@@ -2182,6 +2183,7 @@ void nw_test_init(nw_state* s, tw_lp* lp)
}
/*TODO: nprocs is different for dumpi and online workload. for
* online, it is the number of ranks to be simulated. */
// printf("num_traces_of_job %d\n", num_traces_of_job[lid.job]);
oc_params.nprocs = num_traces_of_job[lid.job];
params = (char*)&oc_params;
strcpy(type_name, "conc_online_comm_workload");
......@@ -2526,7 +2528,7 @@ static void get_next_mpi_operation(nw_state* s, tw_bf * bf, nw_message * m, tw_l
/* Notify ranks from other job that checkpoint traffic has
* completed */
printf("\n Network node %d Rank %d finished at %lf ", s->local_rank, s->nw_id, tw_now(lp));
// printf("\n Network node %d Rank %d finished at %lf ", s->local_rank, s->nw_id, tw_now(lp));
int num_jobs = codes_jobmap_get_num_jobs(jobmap_ctx);
if(num_jobs <= 1 || is_synthetic == 0)
{
......@@ -2537,7 +2539,6 @@ static void get_next_mpi_operation(nw_state* s, tw_bf * bf, nw_message * m, tw_l
if(num_qos_levels == 1) //notify neighbor isn't really compatible with QoS, so notify_neighbor is only called if num_qos_levels == 1 (QoS off)
notify_neighbor(s, lp, bf, m);
// printf("Client rank %llu completed workload, local rank %d .\n", s->nw_id, s->local_rank);
return;
}
switch(mpi_op->op_type)
......
......@@ -2329,16 +2329,16 @@ dragonfly_custom_terminal_final( terminal_state * s,
{
model_net_print_stats(lp->gid, s->dragonfly_stats_array);
if(s->terminal_id == 0)
{
char meta_filename[64];
sprintf(meta_filename, "dragonfly-msg-stats.meta");
// if(s->terminal_id == 0)
// {
// char meta_filename[64];
// sprintf(meta_filename, "dragonfly-msg-stats.meta");
FILE * fp = fopen(meta_filename, "w+");
fprintf(fp, "# Format <LP id> <Terminal ID> <Total Data Size> <Avg packet latency> <# Flits/Packets finished> <Avg hops> <Busy Time> <Max packet Latency> <Min packet Latency >\n");
}
// FILE * fp = fopen(meta_filename, "w+");
// fprintf(fp, "# Format <LP id> <Terminal ID> <Total Data Size> <Avg packet latency> <# Flits/Packets finished> <Avg hops> <Busy Time> <Max packet Latency> <Min packet Latency >\n");
// }
int written = 0;
written += sprintf(s->output_buf, "# Format <LP id> <Terminal ID> <Total Data Size> <Avg packet latency> <# Flits/Packets finished> <Avg hops> <Busy Time> <Max packet Latency> <Min packet Latency >\n");
written += sprintf(s->output_buf + written, "%llu %u %llu %lf %ld %lf %lf %lf %lf\n",
LLU(lp->gid), s->terminal_id, LLU(s->total_msg_size), s->total_time/s->finished_chunks,
s->finished_packets, (double)s->total_hops/s->finished_chunks,
......
......@@ -3144,20 +3144,24 @@ dragonfly_dally_terminal_final( terminal_state * s,
lp_io_write(lp->gid, (char*)"dragonfly-link-stats", written, s->output_buf);
// if(s->terminal_id == 0)
// {
// //fclose(dragonfly_term_bw_log);
// char meta_filename[128];
// sprintf(meta_filename, "dragonfly-cn-stats.meta");
// FILE * fp = NULL;
// fp = fopen(meta_filename, "w+");
// if(fp)
// fprintf(fp, "# Format <LP id> <Terminal ID> <Total Data Size> <Avg packet latency> <# Flits/Packets finished> <Busy Time> <Max packet Latency> <Min packet Latency >\n");
// fclose(fp);
// }
written = 0;
if(s->terminal_id == 0)
{
//fclose(dragonfly_term_bw_log);
char meta_filename[128];
sprintf(meta_filename, "dragonfly-cn-stats.meta");
FILE * fp = NULL;
fp = fopen(meta_filename, "w+");
if(fp)
fprintf(fp, "# Format <LP id> <Terminal ID> <Total Data Size> <Avg packet latency> <# Flits/Packets finished> <Busy Time> <Max packet Latency> <Min packet Latency >\n");
fclose(fp);
written += sprintf(s->output_buf2 + written, "# Format <LP id> <Terminal ID> <Total Data Size> <Avg packet latency> <# Flits/Packets finished> <Busy Time> <Max packet Latency> <Min packet Latency >\n");
}
written = 0;
written += sprintf(s->output_buf2 + written, "%llu %llu %lf %lf %lf %lf %llu %lf\n",
lp->gid, s->terminal_id, s->total_time/s->finished_chunks,
s->busy_time, s->max_latency, s->min_latency,
......
/*
* Copyright (C) 2013 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#include <assert.h>
#include <ross.h>
#include <codes/codes.h>
#include <codes/codes-conc-addon.h>
#ifdef USE_CONC
/* list of available benchmarks begin */
/* list of available benchmarks end */
#endif
static struct codes_conceptual_bench const * bench_array_default[] =
{
#ifdef USE_CONC
/* default benchmarks begin */
/* default benchmarks end */
#endif
NULL
};
// once initialized, adding a bench generator is an error
static int is_bench_init = 0;
static int num_user_benchs = 0;
static struct codes_conceptual_bench const ** bench_array = NULL;
// only call this once
static void init_bench_methods(void)
{
if (is_bench_init)
return;
if (bench_array == NULL)
bench_array = bench_array_default;
else {
// note - includes null char
int num_default_benchs =
(sizeof(bench_array_default) / sizeof(bench_array_default[0]));
printf("\n Num default methods %d ", num_default_benchs);
bench_array = realloc(bench_array,
(num_default_benchs + num_user_benchs + 1) *
sizeof(*bench_array));
memcpy(bench_array+num_user_benchs, bench_array_default,
num_default_benchs * sizeof(*bench_array_default));
}
is_bench_init = 1;
}
int codes_conc_bench_load(
const char *program,
int argc,
char *argv[])
{
init_bench_methods();
int i;
int ret;
for(i=0; bench_array[i] != NULL; i++)
{
if(strcmp(bench_array[i]->program_name, program) == 0)
{
/* load appropriate workload generator */
ret = bench_array[i]->conceptual_main(argc, argv);
if(ret < 0)
{
return(-1);
}
return(i);
}
}
fprintf(stderr, "Error: failed to find benchmark program %s\n", program);
return(-1);
}
void codes_conceptual_add_bench(struct codes_conceptual_bench const * bench)
{
static int bench_array_cap = 10;
if (is_bench_init)
tw_error(TW_LOC,
"adding a conceptual benchmark method after initialization is forbidden");
else if (bench_array == NULL){
bench_array = malloc(bench_array_cap * sizeof(*bench_array));
assert(bench_array);
}
if (num_user_benchs == bench_array_cap) {
bench_array_cap *= 2;
bench_array = realloc(bench_array,
bench_array_cap * sizeof(*bench_array));
assert(bench_array);
}
bench_array[num_user_benchs++] = bench;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment