2005-03-14 20:57:21 +00:00
/*
2005-11-05 19:57:48 +00:00
* Copyright ( c ) 2004 - 2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation . All rights reserved .
* Copyright ( c ) 2004 - 2005 The University of Tennessee and The University
* of Tennessee Research Foundation . All rights
* reserved .
2005-03-14 20:57:21 +00:00
* Copyright ( c ) 2004 - 2005 High Performance Computing Center Stuttgart ,
* University of Stuttgart . All rights reserved .
2005-03-24 12:43:37 +00:00
* Copyright ( c ) 2004 - 2005 The Regents of the University of California .
* All rights reserved .
2006-07-04 20:12:35 +00:00
* Copyright ( c ) 2006 Cisco Systems , Inc . All rights reserved .
2005-03-14 20:57:21 +00:00
* $ COPYRIGHT $
*
* Additional copyrights may follow
*
* $ HEADER $
*/
# include "orte_config.h"
2006-02-12 01:33:29 +00:00
# include "orte/orte_constants.h"
2005-03-14 20:57:21 +00:00
2006-02-12 01:33:29 +00:00
# include "opal/mca/mca.h"
# include "opal/mca/base/base.h"
# include "opal/mca/base/mca_base_param.h"
2005-07-03 23:31:27 +00:00
# include "opal/util/output.h"
2005-03-14 20:57:21 +00:00
2006-10-03 17:40:00 +00:00
# include "orte/dss/dss.h"
# include "orte/mca/errmgr/errmgr.h"
2006-09-14 21:29:51 +00:00
# include "orte/mca/rmaps/base/rmaps_private.h"
2006-02-12 01:33:29 +00:00
# include "orte/mca/rmaps/base/base.h"
2005-03-14 20:57:21 +00:00
/*
* The following file was created by configure . It contains extern
* statements and the definition of an array of pointers to each
* component ' s public mca_base_component_t struct .
*/
2005-07-04 18:24:58 +00:00
# include "orte/mca/rmaps/base/static-components.h"
2005-03-14 20:57:21 +00:00
/*
2006-09-14 21:29:51 +00:00
* Global variables
2005-03-14 20:57:21 +00:00
*/
2006-09-14 21:29:51 +00:00
orte_rmaps_base_t orte_rmaps_base ;
2005-03-14 20:57:21 +00:00
/*
2006-09-14 21:29:51 +00:00
* Declare the RMAPS module to hold the API function pointers
2005-03-14 20:57:21 +00:00
*/
2006-09-14 21:29:51 +00:00
orte_rmaps_base_module_t orte_rmaps = {
2006-10-07 15:45:24 +00:00
orte_rmaps_base_map_job ,
orte_rmaps_base_get_job_map ,
orte_rmaps_base_get_node_map ,
2006-09-14 21:29:51 +00:00
orte_rmaps_base_finalize
} ;
2005-03-14 20:57:21 +00:00
2006-10-07 15:45:24 +00:00
/*
* Include all the RMAPS class instance declarations
*/
# include "orte/mca/rmaps/base/rmaps_class_instances.h"
2005-03-14 20:57:21 +00:00
/**
* Function for finding and opening either all MCA components , or the one
* that was specifically requested via a MCA parameter .
*/
int orte_rmaps_base_open ( void )
{
2006-10-03 17:40:00 +00:00
int param , rc , value ;
2006-10-07 15:45:24 +00:00
char * policy ;
2006-10-03 17:40:00 +00:00
orte_data_type_t tmp ;
2005-03-14 20:57:21 +00:00
/* Debugging / verbose output */
2006-07-04 20:12:35 +00:00
param = mca_base_param_reg_int_name ( " rmaps " , " base_verbose " ,
2005-08-15 18:25:35 +00:00
" Verbosity level for the rmaps framework " ,
false , false , 0 , & value ) ;
2005-03-14 20:57:21 +00:00
if ( value ! = 0 ) {
2005-07-03 23:31:27 +00:00
orte_rmaps_base . rmaps_output = opal_output_open ( NULL ) ;
2005-03-14 20:57:21 +00:00
} else {
orte_rmaps_base . rmaps_output = - 1 ;
}
2005-10-07 22:24:52 +00:00
/* Are we scheduling by node or by slot? */
2006-07-04 20:12:35 +00:00
param = mca_base_param_reg_string_name ( " rmaps " , " base_schedule_policy " ,
2005-10-07 22:24:52 +00:00
" Scheduling Policy for RMAPS. [slot | node] " ,
2007-01-18 17:15:19 +00:00
false , false , " unspec " , & policy ) ;
2006-10-10 19:41:22 +00:00
opal_output ( orte_rmaps_base . rmaps_output , " Scheduling policy: %s " , policy ) ;
2007-01-18 17:15:19 +00:00
if ( 0 = = strcmp ( policy , " unspec " ) ) {
orte_rmaps_base . user_specified_policy = false ;
orte_rmaps_base . bynode = false ; /* default to byslot */
} else if ( 0 = = strcmp ( policy , " node " ) ) {
orte_rmaps_base . user_specified_policy = true ;
orte_rmaps_base . bynode = true ;
2006-10-10 19:41:22 +00:00
} else {
2007-01-18 17:15:19 +00:00
orte_rmaps_base . user_specified_policy = true ;
2006-10-10 19:41:22 +00:00
orte_rmaps_base . bynode = false ;
2005-10-07 22:24:52 +00:00
}
2006-10-07 19:50:12 +00:00
/* Do we want one ppn if num_procs not specified */
param = mca_base_param_reg_int_name ( " rmaps " , " base_pernode " ,
2006-12-12 00:54:05 +00:00
" Launch one ppn as directed " ,
false , false , ( int ) false , & value ) ;
2006-10-07 19:50:12 +00:00
if ( ( int ) true = = value ) {
orte_rmaps_base . per_node = true ;
2006-10-18 14:01:44 +00:00
} else {
orte_rmaps_base . per_node = false ;
2006-10-07 19:50:12 +00:00
}
2006-12-12 00:54:05 +00:00
/* Do we want n ppn */
param = mca_base_param_reg_int_name ( " rmaps " , " base_n_pernode " ,
" Launch n procs/node " ,
false , false , - 1 , & value ) ;
orte_rmaps_base . n_per_node = value ;
2006-07-04 20:12:35 +00:00
/* Should we schedule on the local node or not? */
mca_base_param_reg_int_name ( " rmaps " , " base_schedule_local " ,
" If nonzero, allow scheduling MPI applications on the same node as mpirun (default). If zero, do not schedule any MPI applications on the same node as mpirun " ,
false , false , 1 , & value ) ;
2006-10-18 14:01:44 +00:00
if ( 0 = = value ) {
orte_rmaps_base . no_use_local = true ;
} else {
orte_rmaps_base . no_use_local = false ;
}
2006-07-04 20:12:35 +00:00
2006-07-10 14:10:21 +00:00
/* Should we oversubscribe or not? */
mca_base_param_reg_int_name ( " rmaps " , " base_no_oversubscribe " ,
" If nonzero, then do not allow oversubscription of nodes - mpirun will return an error if there aren't enough nodes to launch all processes without oversubscribing " ,
false , false , 0 , & value ) ;
2006-07-10 21:25:33 +00:00
if ( ( int ) false = = value ) {
orte_rmaps_base . oversubscribe = true ; /** default condition that allows oversubscription */
2006-07-10 14:10:21 +00:00
} else {
orte_rmaps_base . oversubscribe = false ;
}
2006-11-17 19:06:10 +00:00
/* should we display the map after determining it? */
mca_base_param_reg_int_name ( " rmaps_base " , " display_map " ,
" Whether to display the process map after it is computed " ,
false , false , ( int ) false , & value ) ;
if ( ( int ) false = = value ) {
orte_rmaps_base . display_map = false ;
} else {
orte_rmaps_base . display_map = true ;
}
2006-10-03 17:40:00 +00:00
/** register the base system types with the DSS */
tmp = ORTE_JOB_MAP ;
if ( ORTE_SUCCESS ! = ( rc = orte_dss . register_type ( orte_rmaps_base_pack_map ,
orte_rmaps_base_unpack_map ,
( orte_dss_copy_fn_t ) orte_rmaps_base_copy_map ,
( orte_dss_compare_fn_t ) orte_rmaps_base_compare_map ,
( orte_dss_size_fn_t ) orte_rmaps_base_size_map ,
( orte_dss_print_fn_t ) orte_rmaps_base_print_map ,
( orte_dss_release_fn_t ) orte_rmaps_base_std_obj_release ,
ORTE_DSS_STRUCTURED ,
" ORTE_JOB_MAP " , & tmp ) ) ) {
ORTE_ERROR_LOG ( rc ) ;
return rc ;
}
tmp = ORTE_MAPPED_PROC ;
if ( ORTE_SUCCESS ! = ( rc = orte_dss . register_type ( orte_rmaps_base_pack_mapped_proc ,
orte_rmaps_base_unpack_mapped_proc ,
( orte_dss_copy_fn_t ) orte_rmaps_base_copy_mapped_proc ,
( orte_dss_compare_fn_t ) orte_rmaps_base_compare_mapped_proc ,
( orte_dss_size_fn_t ) orte_rmaps_base_size_mapped_proc ,
( orte_dss_print_fn_t ) orte_rmaps_base_print_mapped_proc ,
( orte_dss_release_fn_t ) orte_rmaps_base_std_obj_release ,
ORTE_DSS_STRUCTURED ,
" ORTE_MAPPED_PROC " , & tmp ) ) ) {
ORTE_ERROR_LOG ( rc ) ;
return rc ;
}
tmp = ORTE_MAPPED_NODE ;
if ( ORTE_SUCCESS ! = ( rc = orte_dss . register_type ( orte_rmaps_base_pack_mapped_node ,
orte_rmaps_base_unpack_mapped_node ,
( orte_dss_copy_fn_t ) orte_rmaps_base_copy_mapped_node ,
( orte_dss_compare_fn_t ) orte_rmaps_base_compare_mapped_node ,
( orte_dss_size_fn_t ) orte_rmaps_base_size_mapped_node ,
( orte_dss_print_fn_t ) orte_rmaps_base_print_mapped_node ,
( orte_dss_release_fn_t ) orte_rmaps_base_std_obj_release ,
ORTE_DSS_STRUCTURED ,
" ORTE_MAPPED_NODE " , & tmp ) ) ) {
ORTE_ERROR_LOG ( rc ) ;
return rc ;
}
2006-07-10 14:10:21 +00:00
2005-03-14 20:57:21 +00:00
/* Open up all the components that we can find */
if ( ORTE_SUCCESS ! =
2005-08-15 18:25:35 +00:00
mca_base_components_open ( " rmaps " , orte_rmaps_base . rmaps_output ,
mca_rmaps_base_static_components ,
2005-04-13 03:19:48 +00:00
& orte_rmaps_base . rmaps_opened , true ) ) {
2005-03-14 20:57:21 +00:00
return ORTE_ERROR ;
}
/* All done */
return ORTE_SUCCESS ;
}