/* * Copyright (C) 2013 University of Chicago. * See COPYRIGHT notice in top-level directory. * */ /* SUMMARY: * * This is a test harness for the codes workload API. It sets up two LP * types: clients (which consume operations from the workload generator) and * servers (which service operations submitted by clients). * */ #include #include #include #include "codes/lp-io.h" #include "codes/codes.h" #include "codes/codes-workload.h" #include "codes/configuration.h" #include "codes-workload-test-svr-lp.h" #include "codes-workload-test-cn-lp.h" #define NUM_SERVERS 16 /* number of servers */ #define NUM_CLIENTS 48 /* number of clients */ const tw_optdef app_opt[] = { TWOPT_GROUP("CODES Workload Test Model"), TWOPT_END() }; static int num_clients_per_lp = -1; void workload_set_params() { char io_kernel_meta_path[MAX_NAME_LENGTH_WKLD]; char bgp_config_file[MAX_NAME_LENGTH_WKLD]; configuration_get_value(&config, "PARAMS", "workload_type", NULL, workload_type, MAX_NAME_LENGTH_WKLD); if(strcmp(workload_type,"bgp_io_workload") == 0) { strcpy(bgparams.io_kernel_path,""); strcpy(bgparams.io_kernel_def_path, ""); bgparams.num_cns = NUM_CLIENTS; configuration_get_value(&config, "PARAMS", "io_kernel_meta_path", NULL, io_kernel_meta_path, MAX_NAME_LENGTH_WKLD); strcpy(bgparams.io_kernel_meta_path, io_kernel_meta_path); configuration_get_value(&config, "PARAMS", "bgp_config_file", NULL, bgp_config_file, MAX_NAME_LENGTH_WKLD); strcpy(bgparams.bgp_config_file, bgp_config_file); } } int main( int argc, char **argv) { int nprocs; int rank; int lps_per_proc; int i; int ret; lp_io_handle handle; g_tw_ts_end = 60*60*24*365; tw_opt_add(app_opt); tw_init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); if((NUM_SERVERS + NUM_CLIENTS) % nprocs) { fprintf(stderr, "Error: number of server LPs (%d total) is not evenly divisible by the number of MPI processes (%d)\n", NUM_SERVERS+NUM_CLIENTS, nprocs); exit(-1); } if(argc < 2) { printf("\n Usage: mpirun --sync=2/3 mapping_file_name.conf (optional --nkp) "); exit(-1); } lps_per_proc = (NUM_SERVERS+NUM_CLIENTS) / nprocs; num_clients_per_lp = NUM_CLIENTS / nprocs; configuration_load(argv[2], MPI_COMM_WORLD, &config); tw_define_lps(lps_per_proc, 512, 0); for(i=0; i