From 335c0eafcf4632d27351918fbdaf1364ce3731a7 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Thu, 16 Aug 2012 17:46:46 +0000 Subject: [PATCH] Add a filem test program and set ignores This commit was SVN r27069. --- orte/test/system/Makefile | 2 +- orte/test/system/orte_filem.c | 75 +++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 orte/test/system/orte_filem.c diff --git a/orte/test/system/Makefile b/orte/test/system/Makefile index 4b990946a7..850448b5bc 100644 --- a/orte/test/system/Makefile +++ b/orte/test/system/Makefile @@ -1,4 +1,4 @@ -PROGS = no_op sigusr_trap spin orte_nodename orte_spawn orte_loop_spawn orte_loop_child orte_abort get_limits orte_ring spawn_child orte_tool orte_no_op binom oob_stress iof_stress iof_delay radix orte_barrier orte_mcast opal_interface mcast mcast_recv orte_spin segfault sysinfo orte_exit orte_db orte_sensor test-time event-threads psm_keygen regex orte_errors evpri-test opal-evpri-test evpri-test2 mapper reducer opal_hotel +PROGS = no_op sigusr_trap spin orte_nodename orte_spawn orte_loop_spawn orte_loop_child orte_abort get_limits orte_ring spawn_child orte_tool orte_no_op binom oob_stress iof_stress iof_delay radix orte_barrier orte_mcast opal_interface mcast mcast_recv orte_spin segfault sysinfo orte_exit orte_db orte_sensor test-time event-threads psm_keygen regex orte_errors evpri-test opal-evpri-test evpri-test2 mapper reducer opal_hotel orte_filem all: $(PROGS) diff --git a/orte/test/system/orte_filem.c b/orte/test/system/orte_filem.c new file mode 100644 index 0000000000..68ab794acf --- /dev/null +++ b/orte/test/system/orte_filem.c @@ -0,0 +1,75 @@ +/* -*- C -*- + * + * $HEADER$ + * + * Moving files + */ + +#include + +#include "orte/runtime/runtime.h" +#include "orte/mca/errmgr/errmgr.h" +#include "orte/util/proc_info.h" + +#include "orte/mca/filem/filem.h" + +int main(int argc, char* argv[]) +{ + orte_filem_base_request_t fmreq; + orte_filem_base_process_set_t *fm; + orte_filem_base_file_set_t *fs; + int rc; + orte_vpid_t i; + + if (argc != 3) { + fprintf(stderr, "usage: orte_filem \n"); + exit(1); + } + + if (ORTE_SUCCESS != orte_init(&argc, &argv, ORTE_PROC_NON_MPI)) { + fprintf(stderr, "Failed orte_init\n"); + exit(1); + } + + if (1 == orte_process_info.num_procs) { + fprintf(stderr, "Must invoke more than one process\n"); + orte_finalize(); + exit(1); + } + + /* setup the filem request list */ + OBJ_CONSTRUCT(&fmreq, orte_filem_base_request_t); + /* we want to move the files to the location of + * every process in this job + */ + for (i=0; i < orte_process_info.num_procs; i++) { + if (i != ORTE_PROC_MY_NAME->vpid) { + fm = OBJ_NEW(orte_filem_base_process_set_t); + fm->source.jobid = ORTE_PROC_MY_NAME->jobid; + fm->source.vpid = ORTE_PROC_MY_NAME->vpid; + fm->sink.jobid = ORTE_PROC_MY_NAME->jobid;; + fm->sink.vpid = i; + opal_list_append(&fmreq.process_sets, &fm->super); + } + } + + fs = OBJ_NEW(orte_filem_base_file_set_t); + fs->local_target = strdup(argv[1]); + fs->remote_target = strdup(argv[2]); + fs->remote_hint = ORTE_FILEM_HINT_SHARED; + fs->target_flag = ORTE_FILEM_TYPE_FILE; + opal_list_append(&fmreq.file_sets, &fs->super); + + + /* move files - this blocks until the files have been moved */ + if (ORTE_SUCCESS != (rc = orte_filem.put(&fmreq))) { + ORTE_ERROR_LOG(rc); + exit(1); + } + + if (ORTE_SUCCESS != orte_finalize()) { + fprintf(stderr, "Failed orte_finalize\n"); + exit(1); + } + return 0; +}