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 .
2011-06-23 20:38:02 +00:00
* Copyright ( c ) 2004 - 2011 The University of Tennessee and The University
2005-11-05 19:57:48 +00:00
* 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"
2008-02-28 01:57:57 +00:00
# include "orte/constants.h"
2005-03-14 20:57:21 +00:00
2009-04-29 00:49:23 +00:00
# ifdef HAVE_STRING_H
# include <string.h>
# endif
2008-06-18 03:15:56 +00:00
# if !ORTE_DISABLE_FULL_SUPPORT
2006-02-12 01:33:29 +00:00
# include "opal/mca/mca.h"
2009-02-14 02:26:12 +00:00
# include "opal/util/output.h"
2006-02-12 01:33:29 +00:00
# include "opal/mca/base/base.h"
# include "opal/mca/base/mca_base_param.h"
2009-08-11 02:51:27 +00:00
# include "opal/mca/paffinity/paffinity.h"
2005-03-14 20:57:21 +00:00
2009-08-11 02:51:27 +00:00
# include "orte/runtime/orte_globals.h"
2009-10-13 04:19:07 +00:00
# include "orte/util/show_help.h"
2006-10-03 17:40:00 +00:00
2006-09-14 21:29:51 +00:00
# include "orte/mca/rmaps/base/rmaps_private.h"
2008-06-18 03:15:56 +00:00
# endif
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
2008-06-18 03:15:56 +00:00
# if ORTE_DISABLE_FULL_SUPPORT
/* have to include a bogus function here so that
* the build system sees at least one function
* in the library
*/
int orte_rmaps_base_open ( void )
{
return ORTE_SUCCESS ;
}
# else
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
*/
2008-02-28 01:57:57 +00:00
orte_rmaps_t orte_rmaps = {
2006-10-07 15:45:24 +00:00
orte_rmaps_base_map_job ,
2008-02-28 01:57:57 +00:00
orte_rmaps_base_get_job_map
2006-09-14 21:29:51 +00:00
} ;
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 )
{
2008-02-28 01:57:57 +00:00
int param , value ;
2006-10-07 15:45:24 +00:00
char * policy ;
2008-09-23 15:46:34 +00:00
bool btmp ;
2005-03-14 20:57:21 +00:00
2008-02-28 01:57:57 +00:00
/* init the globals */
2011-02-15 23:24:31 +00:00
OBJ_CONSTRUCT ( & orte_rmaps_base . selected_modules , opal_list_t ) ;
2008-02-28 01:57:57 +00:00
/* Debugging / verbose output. Always have stream open, with
verbose set by the mca open system . . . */
2008-06-09 14:53:58 +00:00
orte_rmaps_base . rmaps_output = opal_output_open ( NULL ) ;
2005-03-14 20:57:21 +00:00
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 " ,
2009-09-22 18:44:53 +00:00
" Scheduling Policy for RMAPS. [slot (alias:core) | socket | board | node] " ,
2009-10-11 23:50:42 +00:00
false , false , " slot " , & policy ) ;
2006-10-10 19:41:22 +00:00
2009-09-22 18:44:53 +00:00
/* if something is specified, do not override what may already
* be present - could have been given on cmd line
*/
if ( 0 = = strcasecmp ( policy , " slot " ) | |
0 = = strcasecmp ( policy , " core " ) ) {
ORTE_XSET_MAPPING_POLICY ( ORTE_MAPPING_BYSLOT ) ;
} else if ( 0 = = strcasecmp ( policy , " socket " ) ) {
ORTE_XSET_MAPPING_POLICY ( ORTE_MAPPING_BYSOCKET ) ;
} else if ( 0 = = strcasecmp ( policy , " board " ) ) {
ORTE_XSET_MAPPING_POLICY ( ORTE_MAPPING_BYBOARD ) ;
} else if ( 0 = = strcasecmp ( policy , " node " ) ) {
ORTE_XSET_MAPPING_POLICY ( ORTE_MAPPING_BYNODE ) ;
2005-10-07 22:24:52 +00:00
}
2009-08-11 02:51:27 +00:00
/* #cpus/rank to use */
2009-10-13 04:19:07 +00:00
param = mca_base_param_reg_int_name ( " rmaps " , " base_cpus_per_proc " ,
2009-08-11 02:51:27 +00:00
" Number of cpus to use for each rank [1-2**15 (default=1)] " ,
2009-08-30 14:30:36 +00:00
false , false , 1 , NULL ) ;
mca_base_param_reg_syn_name ( param , " rmaps " , " base_cpus_per_rank " , false ) ;
mca_base_param_lookup_int ( param , & value ) ;
2009-08-11 02:51:27 +00:00
orte_rmaps_base . cpus_per_rank = value ;
2009-10-20 07:28:23 +00:00
/* if the #cpus/rank > #cpus/socket, politely tell the user and abort
*
* NOTE : have to check that the default_num_cores_per_socket was set
* as ompi_info doesn ' t call the ess init function , and thus might
* leave this value at its default of zero
*/
if ( 0 < orte_default_num_cores_per_socket & &
orte_rmaps_base . cpus_per_rank > orte_default_num_cores_per_socket ) {
2009-10-13 04:19:07 +00:00
orte_show_help ( " help-orte-rmaps-base.txt " , " too-many-cpus-per-rank " ,
true , orte_rmaps_base . cpus_per_rank ,
orte_default_num_cores_per_socket ) ;
return ORTE_ERR_SILENT ;
}
2009-08-26 02:01:49 +00:00
/* if the cpus/rank > 1, then we have to bind to cores UNLESS the binding has
* already been set to something else
*/
2009-08-11 02:51:27 +00:00
if ( 1 < orte_rmaps_base . cpus_per_rank ) {
2009-08-26 02:01:49 +00:00
ORTE_XSET_BINDING_POLICY ( ORTE_BIND_TO_CORE ) ;
2009-08-11 02:51:27 +00:00
}
/* stride to use */
param = mca_base_param_reg_int_name ( " rmaps " , " base_stride " ,
" When binding multiple cores to a rank, the step size to use between cores [1-2**15 (default: 1)] " ,
false , false , 1 , & value ) ;
orte_rmaps_base . stride = value ;
2006-07-04 20:12:35 +00:00
/* Should we schedule on the local node or not? */
2007-03-24 16:16:16 +00:00
mca_base_param_reg_int_name ( " rmaps " , " base_no_schedule_local " ,
" If false, allow scheduling MPI applications on the same node as mpirun (default). If true, do not schedule any MPI applications on the same node as mpirun " ,
false , false , ( int ) false , & value ) ;
2008-04-09 22:10:53 +00:00
if ( value ) {
2009-08-11 02:51:27 +00:00
orte_default_mapping_policy | = ORTE_MAPPING_NO_USE_LOCAL ;
2008-04-09 22:10:53 +00:00
}
2006-07-04 20:12:35 +00:00
2006-07-10 14:10:21 +00:00
/* Should we oversubscribe or not? */
2008-02-28 01:57:57 +00:00
/** default condition that allows oversubscription */
2006-07-10 14:10:21 +00:00
mca_base_param_reg_int_name ( " rmaps " , " base_no_oversubscribe " ,
2007-03-24 16:16:16 +00:00
" If true, 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 , ( int ) false , & value ) ;
2008-02-28 01:57:57 +00:00
if ( value ) {
2006-07-10 14:10:21 +00:00
orte_rmaps_base . oversubscribe = false ;
2008-02-28 01:57:57 +00:00
} else {
orte_rmaps_base . oversubscribe = true ;
2006-07-10 14:10:21 +00:00
}
2006-11-17 19:06:10 +00:00
/* should we display the map after determining it? */
2007-08-18 03:05:45 +00:00
mca_base_param_reg_int_name ( " rmaps " , " base_display_map " ,
2006-11-17 19:06:10 +00:00
" Whether to display the process map after it is computed " ,
false , false , ( int ) false , & value ) ;
2008-02-28 01:57:57 +00:00
orte_rmaps_base . display_map = OPAL_INT_TO_BOOL ( value ) ;
2006-07-10 14:10:21 +00:00
2008-09-23 15:46:34 +00:00
/* should we display a detailed (developer-quality) version of the map after determining it? */
mca_base_param_reg_int_name ( " rmaps " , " base_display_devel_map " ,
" Whether to display a developer-detail process map after it is computed " ,
false , false , ( int ) false , & value ) ;
btmp = OPAL_INT_TO_BOOL ( value ) ;
if ( btmp ) {
orte_rmaps_base . display_map = true ;
orte_devel_level_output = true ;
}
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 ,
2008-02-28 01:57:57 +00:00
& orte_rmaps_base . available_components , true ) ) {
2005-03-14 20:57:21 +00:00
return ORTE_ERROR ;
}
/* All done */
return ORTE_SUCCESS ;
}
2008-06-18 03:15:56 +00:00
2011-02-15 23:24:31 +00:00
OBJ_CLASS_INSTANCE ( orte_rmaps_base_selected_module_t ,
opal_list_item_t ,
NULL , NULL ) ;
2008-06-18 03:15:56 +00:00
# endif /* ORTE_DISABLE_FULL_SUPPORT */