diff --git a/codes/CodesKernelHelpers.h b/codes/CodesKernelHelpers.h index ff5d3f21877ce943471f77d64f04b61d5639bd52..011ade433c67f835055ae03e011231169bcf15f2 100644 --- a/codes/CodesKernelHelpers.h +++ b/codes/CodesKernelHelpers.h @@ -29,6 +29,7 @@ enum cl_event_t CL_GETSIZE=1, CL_GETRANK, CL_WRITEAT, + CL_READAT, CL_OPEN, CL_CLOSE, CL_SYNC, diff --git a/src/iokernellang/CodesKernelHelpers.c b/src/iokernellang/CodesKernelHelpers.c index d7d3be50b46f68d5313e6ea91ec7d4f18344f3e1..b03697ae36a7fd20c786ac4ef0b72059730400fb 100644 --- a/src/iokernellang/CodesKernelHelpers.c +++ b/src/iokernellang/CodesKernelHelpers.c @@ -22,6 +22,8 @@ char * code_kernel_helpers_kinstToStr(int inst) { case WRITEAT: return "WRITEAT"; + case READAT: + return "READAT"; case GETGROUPRANK: return "GETGROUPRANK"; case GETGROUPSIZE: @@ -51,6 +53,8 @@ char * code_kernel_helpers_cleventToStr(int inst) { case CL_WRITEAT: return "CL_WRITEAT"; + case CL_READAT: + return "CL_READAT"; case CL_GETRANK: return "CL_GETRANK"; case CL_GETSIZE: @@ -80,6 +84,8 @@ static int convertKLInstToEvent(int inst) { case WRITEAT: return CL_WRITEAT; + case READAT: + return CL_READAT; case GETGROUPRANK: return CL_GETRANK; case GETGROUPSIZE: @@ -214,6 +220,7 @@ int codes_kernel_helper_parse_input(CodesIOKernel_pstate * ps, CodesIOKernelCont { /* for each instrunction that triggers a simulator event */ case WRITEAT: + case READAT: case GETGROUPRANK: case GETGROUPSIZE: case CLOSE: @@ -247,6 +254,7 @@ int codes_kernel_helper_parse_input(CodesIOKernel_pstate * ps, CodesIOKernelCont case CL_GETRANK: case CL_GETSIZE: case CL_WRITEAT: + case CL_READAT: case CL_OPEN: case CL_CLOSE: case CL_SYNC: diff --git a/src/util/README.codes-mapping.txt b/src/util/README.codes-mapping.txt new file mode 100644 index 0000000000000000000000000000000000000000..95a60baab816b93bfdeb4f04690dbb0c4d32e2fb --- /dev/null +++ b/src/util/README.codes-mapping.txt @@ -0,0 +1,78 @@ +- The codes-mapping.h header file contains the function definitions for the codes LP mapping. + +Step 1: Specifying the LP types in the config file: + +- Here is an example of a config file that specifies the codes LP mapping +-------------------------------example-test.conf----------------------------- +LPGROUPS +{ + MODELNET_GRP + { + repetitions="16"; + server="1"; + example_net="1"; + } +} +------------------------------------------------------------------------------ +In this config file, there are multiple LP types defined in a single LP group (As we will see in a later +example, there can be multiple LP groups in a config file too). There is 1 server LP and 1 example_net +LP type in a group and this combination is repeated 16 time (repetitions="16"). ROSS will assign the +LPs to the PEs (PEs is an abstraction for MPI rank in ROSS) by placing 1 server LP then 1 example_net +LP a total of 16 times. This configuration is useful if there is some form of communication involved +between the server and example_net LP types, in which case ROSS will place them on the same PE and +communication between server and example_net LPs will not involve remote messages. + +The number of server and example_net LPs can be more than 1. Lets assume if we have two example_net +LPs for each server then the config file will have the following format: + +-------------------------------example-test2.conf----------------------------- +LPGROUPS +{ + MODELNET_GRP + { + repetitions="16"; + server="1"; + example_net="2"; + } +} +------------------------------------------------------------------------------ + +Step 2: Loading the config file in the model: + +After the initialization function calls of ROSS (tw_init), the configuration file can be loaded in the +example program using: + +configuration_load(example-test.conf, MPI_COMM_WORLD, &config); + +Step 3: Each LP type must register itself with the lp_type_register before setting up the codes-mapping. +Following is an example function that registers 'server' lp type. + +static void svr_add_lp_type() +{ + lp_type_register("server", svr_get_lp_type()); +} + +Step 4: Call to codes_mapping_setup that sets up the LPs of each registered LP type as specified in the config +file. + +codes_mapping_setup(); + +Step 5: Querying number of LPs in a repetition + +int codes_mapping_get_lp_count(group_name, lp_type_name); + +For example, to query the number of server LPs in example-test2.conf file, calling + +num_servers = codes_mapping_get_lp_count("MODELNET_GRP", "server"); + +will return 2. + +Step 6: Querying number of repetitions in a particular group, use + +int codes_mapping_get_group_reps(group_name); + +For example, to query the number of repetitions in example-test2.conf file, calling + +num_repetitions = codes_mapping_get_group_reps("MODELNET_GRP"); + +will return 16. diff --git a/src/workload/codes-bgp-io-wrkld.c b/src/workload/codes-bgp-io-wrkld.c index 23d1eab04e5e75ab530dc76ce6dc6dae3ad3897e..813e96b27217a349485e8d9ea8aa6273cb37b95b 100644 --- a/src/workload/codes-bgp-io-wrkld.c +++ b/src/workload/codes-bgp-io-wrkld.c @@ -90,61 +90,31 @@ int bgp_io_workload_load(const char* params, int rank) /* Maps the enum types from I/O language to the CODES workload API */ static int convertTypes(int inst) { - int op_type = -1; switch(inst) { case CL_WRITEAT: /* write to file */ - { - op_type = CODES_WK_WRITE; - } - break; + return CODES_WK_WRITE; + case CL_READAT: + return CODES_WK_READ; case CL_CLOSE: - { - op_type = CODES_WK_CLOSE; /* close the file */ - } - break; + return CODES_WK_CLOSE; /* close the file */ case CL_OPEN: - { - op_type = CODES_WK_OPEN; /* open file */ - } - break; + return CODES_WK_OPEN; /* open file */ case CL_SYNC: - { - op_type = CODES_WK_BARRIER; /* barrier in CODES workload is similar to sync in I/O lang? */ - } - break; + return CODES_WK_BARRIER; /* barrier in CODES workload is similar to sync in I/O lang? */ case CL_SLEEP: - { - op_type = CODES_WK_DELAY; /* sleep or delay */ - } - break; + return CODES_WK_DELAY; /* sleep or delay */ case CL_EXIT: - { - op_type = CODES_WK_END; /* end of the operations/ no more operations in file */ - } - break; + return CODES_WK_END; /* end of the operations/ no more operations in file */ case CL_DELETE: - { - op_type = -2; - } - break; + return -2; case CL_GETRANK: - { - op_type = -3; /* defined in I/O lang but not in workloads API*/ - } - break; + return -3; /* defined in I/O lang but not in workloads API*/ case CL_GETSIZE: - { - op_type = -4; /* defined in I/O lang but not in workload API */ - } - break; + return -4; /* defined in I/O lang but not in workload API */ default: - { - //printf("\n convert type undefined %d ", inst); - op_type = -1; - } - } - return op_type; + return -1; + } } /* Gets the next operation specified in the workload file for the simulated MPI rank @@ -196,7 +166,9 @@ void bgp_io_workload_get_next(int rank, struct codes_workload_op *op) break; case CODES_WK_READ: { - /* to be added (the BG/P model does not supports read operations right now) */ + op->u.read.file_id = (wrkld_arr[local_rank].next_event).var[0]; + op->u.read.offset = (wrkld_arr[local_rank].next_event).var[2]; + op->u.read.size = (wrkld_arr[local_rank].next_event).var[1]; } break; default: