static int opal_event_base_open(mca_base_open_flag_t flags) { int rc = OPAL_SUCCESS; /* Silence compiler warning */ (void) flags; /* no need to open the components since we only use one */ /* init the lib */ if (OPAL_SUCCESS != (rc = opal_event_init())) { return rc; } /* Declare our intent to use threads */ opal_event_use_threads(); /* get our event base */ if (NULL == (opal_sync_event_base = opal_event_base_create())) { return OPAL_ERROR; } /* set the number of priorities */ if (0 < OPAL_EVENT_NUM_PRI) { opal_event_base_priority_init(opal_sync_event_base, OPAL_EVENT_NUM_PRI); } return rc; }
int main (int argc, char **argv) { struct opal_event signal_int, signal_term; /* Initalize the event library */ opal_event_init(); /* Initalize one event */ opal_event_set(&signal_term, SIGUSR1, OPAL_EV_SIGNAL|OPAL_EV_PERSIST, signal_cb, &signal_term); opal_event_set(&signal_int, SIGUSR2, OPAL_EV_SIGNAL|OPAL_EV_PERSIST, signal_cb, &signal_int); opal_event_add(&signal_int, NULL); opal_event_add(&signal_term, NULL); opal_event_dispatch(); return (0); }
int opal_init(int* pargc, char*** pargv) { int ret; char *error = NULL; if( ++opal_initialized != 1 ) { if( opal_initialized < 1 ) { return OPAL_ERROR; } return OPAL_SUCCESS; } /* initialize util code */ if (OPAL_SUCCESS != (ret = opal_init_util(pargc, pargv))) { return ret; } /* initialize the mca */ if (OPAL_SUCCESS != (ret = mca_base_open())) { error = "mca_base_open"; goto return_error; } /* open the processor affinity base */ if (OPAL_SUCCESS != (ret = opal_paffinity_base_open())) { error = "opal_paffinity_base_open"; goto return_error; } if (OPAL_SUCCESS != (ret = opal_paffinity_base_select())) { error = "opal_paffinity_base_select"; goto return_error; } /* the memcpy component should be one of the first who get * loaded in order to make sure we ddo have all the available * versions of memcpy correctly configured. */ if( OPAL_SUCCESS != (ret = opal_memcpy_base_open()) ) { error = "opal_memcpy_base_open"; goto return_error; } /* open the memory manager components. Memory hooks may be triggered before this (any time after mem_free_init(), actually). This is a hook available for memory manager hooks without good initialization routine support */ if (OPAL_SUCCESS != (ret = opal_memory_base_open())) { error = "opal_memory_base_open"; goto return_error; } /* initialize the memory manager / tracker */ if (OPAL_SUCCESS != (ret = opal_mem_hooks_init())) { error = "opal_mem_hooks_init"; goto return_error; } /* initialize the memory checker, to allow early support for annotation */ if (OPAL_SUCCESS != (ret = opal_memchecker_base_open())) { error = "opal_memchecker_base_open"; goto return_error; } /* select the memory checker */ if (OPAL_SUCCESS != (ret = opal_memchecker_base_select())) { error = "opal_memchecker_base_select"; goto return_error; } if (OPAL_SUCCESS != (ret = opal_backtrace_base_open())) { error = "opal_backtrace_base_open"; goto return_error; } if (OPAL_SUCCESS != (ret = opal_timer_base_open())) { error = "opal_timer_base_open"; goto return_error; } /* setup the carto framework */ if (OPAL_SUCCESS != (ret = opal_carto_base_open())) { error = "opal_carto_base_open"; goto return_error; } if (OPAL_SUCCESS != (ret = opal_carto_base_select())) { error = "opal_carto_base_select"; goto return_error; } /* * Need to start the event and progress engines if noone else is. * opal_cr_init uses the progress engine, so it is lumped together * into this set as well. */ /* * Initialize the event library */ if (OPAL_SUCCESS != (ret = opal_event_init())) { error = "opal_event_init"; goto return_error; } /* * Initialize the general progress engine */ if (OPAL_SUCCESS != (ret = opal_progress_init())) { error = "opal_progress_init"; goto return_error; } /* we want to tick the event library whenever possible */ opal_progress_event_users_increment(); /* * Initalize the checkpoint/restart functionality * Note: Always do this so we can detect if the user * attempts to checkpoint a non checkpointable job, * otherwise the tools may hang or not clean up properly. */ if (OPAL_SUCCESS != (ret = opal_cr_init() ) ) { error = "opal_cr_init() failed"; goto return_error; } return OPAL_SUCCESS; return_error: opal_show_help( "help-opal-runtime.txt", "opal_init:startup:internal-failure", true, error, ret ); return ret; }