42                printf(
"Maximum number of booked tags exhausted\n");
 
   61         printf(
"===============\n" );
 
   62         printf(
"Id : %d\n", desc->
id );
 
   63         printf(
"Size : %d\n", desc->
size );
 
   64         printf(
"Root : %d\n", desc->
root_id );
 
   65         printf(
"Name : %s\n", desc->
name );
 
   66         printf(
"===============\n" );
 
   83         PMPI_Comm_rank( MPI_COMM_WORLD, &rank );
 
   87         printf(
"======================\n");
 
   88         for( i=0 ; i <  map->
count; i++ )
 
   89                 printf(
"%d --> %d\n", rank, map->
ranks[i] );
 
   91         printf(
"======================\n");
 
  101         int target_rank, source_rank;
 
  141         if( partition_rank == 0 )
 
  145                                                   MPI_COMM_WORLD, &s) != MPI_SUCCESS )
 
  151                 if( remote_mode != mode )
 
  153                         printf(
"Mismatching modes between partition %s and %d\n",  
VMPI_Get_desc()->name, target);
 
  161                 printf(
"(%s[%d] -> %d[%d] ) : VMPI_MAP_FIXED is not possible on communicators of different sizes\n",
VMPI_Get_desc()->name, pa->
size, target, pb->
size);
 
  183                 if( pa->
id < pb->
id )
 
  214                 ranks = malloc( 
sizeof( 
int ) );
 
  235                 if( global_rank == rx_part->
root_id )
 
  237                         for( i = 0 ; i < tx_part->
size ; i++ )
 
  246                                                 target_rank = i % rx_part->
size;
 
  249                                                 target_rank = rand() % rx_part->
size;
 
  252                                                 printf(
"No such mode in %s\n", __FUNCTION__ );
 
  257                                 if( target_rank == 0 )
 
  260                                         count = incoming_count;
 
  261                                         incoming = realloc( incoming, incoming_count * 
sizeof( 
int ) );
 
  268                                         incoming[incoming_count - 1] = source_rank;
 
  279                                         if( PMPI_Send((
void *)&source_rank, 1, MPI_INT, rx_part->
root_id + target_rank,
 
  286                                         source_target = rx_part->
root_id + target_rank;
 
  296                         for( i = 1 ; i < rx_part->
size ; i++ )
 
  314                                 if( source_rank < 0 )
 
  318                                 count = incoming_count;
 
  319                                 incoming = realloc( incoming, incoming_count * 
sizeof( 
int ) );
 
  326                                 incoming[incoming_count - 1] = source_rank;
 
  334         int prev_count = map->
count;
 
  347                 memcpy( map->
ranks + prev_count , ranks, count * 
sizeof( 
int ) );
 
  360                 for( i = 0 ; i < map->
count - 2 ; i++ )
 
  364                                 target_rank = map->
ranks[i];
 
  366                                 map->
ranks[i+1] = target_rank;
 
  396                         len += strlen( argv[i] ) + 1;
 
  403                         if( i != (argc - 1) )
 
  415         int partition_rank, global_rank, i;
 
  418         PMPI_Comm_rank( partition_comm, &partition_rank);
 
  426         if( global_rank == 0 )
 
  477                 if( partition_rank == 0 )
 
  504         int job_string_len, i;
 
  509         for( i = 0 ; i < argc ; i++ )
 
  510                 job_string_len += strlen( argv[i] );
 
  513         job_string = malloc( job_string_len );
 
  521         for( i = 0 ; i < argc ; i++ )
 
  522                 strcat( job_string, argv[i] );
 
  551         int global_size, global_rank;
 
  557         local_desc.
crc = job_crc;
 
  562         if( global_rank == 0 )
 
  566                 if( 1 < global_size )
 
  579                 if( PMPI_Get_count(&s, MPI_CHAR, &number_of_desc) != MPI_SUCCESS )
 
  599                 for( i = 0 ; i < number_of_desc ; i++ )
 
  601                         if( remote_desc[i].
crc == job_crc )
 
  603                                 local_desc.
id = remote_desc[i].
id;
 
  613                         remote_desc = realloc( remote_desc, 
sizeof( 
struct TMP_Partition_desc) * number_of_desc );
 
  619                         local_desc.
id = remote_desc[number_of_desc - 2].
id + 1;
 
  620                         remote_desc[number_of_desc - 1] = local_desc;
 
  623                 if( global_rank != (global_size - 1 ) )
 
  634         if( PMPI_Bcast( (
void *)&number_of_desc, 1, MPI_INT, global_size - 1, 
VMPI_Get_vmpi_comm() ) != MPI_SUCCESS )
 
  640         *partition_count = number_of_desc;
 
  642         return local_desc.
id;
 
  648         PMPI_Comm_rank( MPI_COMM_WORLD, &rank );
 
  650         PMPI_Comm_size( MPI_COMM_WORLD, &size );
 
  655                 printf(
"You must launch at least two processes to perform a splitting\n");
 
  661         char *proportion = getenv(
"VMPI_RATIO");
 
  667                         printf(
"==========================================================");
 
  668                         printf(
"Could not locate the VMPI_RATIO variable in env\n");
 
  669                         printf(
"Please use the dedicated launcher or set it manually\n");
 
  670                         printf(
"==========================================================");
 
  677         char *end_ptr = NULL;
 
  678         double ratio = strtod( proportion, &end_ptr );
 
  680         if( (errno == ERANGE ) || (proportion == end_ptr) )
 
  683                printf(
"Could not parse value %s\n", proportion );
 
  689                  printf(
"==========================================================\n");
 
  690                  printf(
"Ratio cannot exceed 0.5 (got %g)\n", ratio );
 
  691                  printf(
"==========================================================\n");
 
  695          int analyzer_size = size * ratio;
 
  697          if( analyzer_size == 0 )
 
  702          int program_size = size - analyzer_size;
 
  704          if( (program_size + analyzer_size) != size )
 
  706                  printf(
"Failed to compute compatibility MPMD sizes (%d + %d = %d / %d)\n", analyzer_size, program_size, program_size + analyzer_size, size);
 
  711                  printf(
"=================================================================================\n");
 
  712                  printf(
"VMPI will run with %d instrumented processes and %d analyzer (env VMPI_RATIO=%g)\n", program_size, analyzer_size, ratio);
 
  713                  printf(
"=================================================================================\n");
 
  716         int partition_color = 0;
 
  718         if( rank < program_size )
 
  731         *partition_count = 2;
 
  742         return partition_color;
 
  746     char error_string[MPI_MAX_ERROR_STRING];
 
  747     int error_string_length;
 
  748     printf(
"ccg_mpi_error_handler: entry\n");
 
  749     printf(
"ccg_mpi_error_handler: error_code = %d\n", *error_code);
 
  751     error_string[error_string_length] = 
'\0';
 
  752     printf(
"ccg_mpi_error_handler: error_string = %s\n", error_string);
 
  753     printf(
"ccg_mpi_error_handler: exit\n");
 
  764         if( PMPI_Comm_dup( MPI_COMM_WORLD , &__vmpi_status.
vmpi_communicator ) != MPI_SUCCESS )
 
  770         MPI_Errhandler errhandler;
 
  805         PMPI_Comm_rank( MPI_COMM_WORLD, &rank );
 
  810         ret=PMPI_Comm_split(MPI_COMM_WORLD,__vmpi_status.
mypartition, rank, &tmp_comm);
 
  842         PMPI_Barrier( MPI_COMM_WORLD );
 
void VMPI_Fill_desc_command(VMPI_Partition_desc *desc, int argc, char **argv)
 
static uint64_t MALP_Trace_crc64(char *source, uint64_t size)
Computes the hash of a given data. 
 
#define VMPI_COMMAND_LEN
Maximum command line name. 
 
int vmpi_enabled
VMPI is enabled. 
 
int numpartitions
Partitions number. 
 
int VMPI_get_new_tag()
Book a tag on VMPI's communicator for this process. 
 
char name[200]
Name of the partition (could be NONE) 
 
void ccg_mpi_error_handler(MPI_Comm *communicator, int *error_code,...)
 
static MPI_Comm VMPI_Get_vmpi_comm()
Get VMPI's copy of MPI_COMM_WORLD. 
 
int id
the id of the partition 
 
int VMPI_Release()
Releases VMPI. 
 
int mypartition
Current partition id. 
 
int VMPI_Detect_Partitions(uint64_t job_crc, int *partition_count)
 
static MPI_Comm VMPI_Get_partition_comm()
Returns current partition's communicator. 
 
int current_tag
Counter for local process tags. 
 
#define VMPI_NG_MAXIMUM_TAGS
Maximum number of tags allowed. 
 
Map processes in a round robin fashion. 
 
uint64_t VMPI_Compute_job_crc(int argc, char **argv)
 
int VMPI_Map_partitions(int target, VMPI_Map_mode mode, VMPI_Map *map)
Map to another partition (can be additive) 
 
static int VMPI_Get_partition_count()
Return the number of partitions. 
 
int size
Number of tasks involved in the partition. 
 
Structure holding partitions descriptions. 
 
int root_id
Identifier of the root of the partition. 
 
char partition_name[200]
Current partition name. 
 
MPI_Comm partition_comm
The communicator of the partition. 
 
void VMPI_Display_descs()
Display all the partitions descriptions in order. 
 
VMPI_Partition_desc * partition_descs
Partitions descriptions. 
 
static int VMPI_Set_partition_name(char *name)
Used to setup partition name for a given executable. 
 
char program_name[VMPI_PNAME_LEN]
Program name as stated in argv[0]. 
 
Randomly associates processes. 
 
MPI_Comm vmpi_communicator
current MPI communicator 
 
static VMPI_Partition_desc * VMPI_Get_desc_by_id(int id)
Find a descriptions by its ID. 
 
int VMPI_Compatibility_MPMD(int *partition_count)
 
char command_line[VMPI_COMMAND_LEN]
Complete command used to invoke the program. 
 
void VMPI_Display_desc(VMPI_Partition_desc *desc)
Prints all the fields of a partition descriptions. 
 
int id
Unique identifier of the partition. 
 
int(* vmpi_trampoline)(int argc, char **argv)
 
Failed to allocate some memory. 
 
#define VMPI_PNAME_LEN
Maximum size of a program name. 
 
Utility struct for VMPI_Detect_Partitions(). Used to describe a partition. 
 
int VMPI_Dispatch_descs(MPI_Comm partition_comm, int argc, char **argv)
 
Associates each process to one process. 
 
static int VMPI_Get_partition_id()
Returns the unique ID of the current partition. 
 
static VMPI_Partition_desc * VMPI_Get_desc()
Returns current partition's descriptions. 
 
struct VMPI_Status __vmpi_status
global VMPI status 
 
int MPI_Error_string(int errorcode, char *string, int *resultlen)
 
int VMPI_Enabled()
indicates if VMPI is enabled 
 
uint64_t crc
the hash of the partition 
 
void VMPI_Print_map(VMPI_Map *map)
 
int VMPI_Init(int *argc, char ***argv)
Initializes VMPI. 
 
char trampoline_partition_name[200]
 
int count
Number of ranks. 
 
VMPI_Map_mode
Defines mapping method. 
 
#define VMPI_NG_ARBITRARY_VALUE
Defines of magic values. 
 
void MALP_Trace_crc64_init()
This initializes the CRC64 internals.