|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
* Copyright © 2016 Inria. All rights reserved.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* $COPYRIGHT$
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* Additional copyrights may follow
|
|
Packit Service |
c5cf8c |
* See COPYING in top-level directory.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* $HEADER$
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#ifndef _NETLOCSCOTCH_H_
|
|
Packit Service |
c5cf8c |
#define _NETLOCSCOTCH_H_
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#ifndef _GNU_SOURCE
|
|
Packit Service |
c5cf8c |
#define _GNU_SOURCE // for asprintf
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#include <hwloc/autogen/config.h>
|
|
Packit Service |
c5cf8c |
#include <netloc.h>
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Includes for Scotch */
|
|
Packit Service |
c5cf8c |
#include <stdio.h>
|
|
Packit Service |
c5cf8c |
#include <scotch.h>
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#ifdef __cplusplus
|
|
Packit Service |
c5cf8c |
extern "C" {
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/**
|
|
Packit Service |
c5cf8c |
* A structure to represent process mapping
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
typedef struct {
|
|
Packit Service |
c5cf8c |
int rank; /**< Rank of the process */
|
|
Packit Service |
c5cf8c |
char *nodename; /**< Name of the node */
|
|
Packit Service |
c5cf8c |
int core; /**< Physical slot number of the core */
|
|
Packit Service |
c5cf8c |
} netlocscotch_core_t;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/**
|
|
Packit Service |
c5cf8c |
* \brief Build the Scotch architecture representing the all machine
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* \param arch Pointer to the Scotch arch that will be built.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* \returns 0 on success
|
|
Packit Service |
c5cf8c |
* \returns NETLOC_ERROR on error
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
int netlocscotch_build_global_arch(SCOTCH_Arch *arch);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/**
|
|
Packit Service |
c5cf8c |
* \brief Build the Scotch architecture representing the available resources
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* This function reads the file about available resources, found by reading the
|
|
Packit Service |
c5cf8c |
* environment variable NETLOC_CURRENTSLOTS. The file must be generated before
|
|
Packit Service |
c5cf8c |
* calling the program running this functions with: mpirun -np <nprocs>
|
|
Packit Service |
c5cf8c |
* netloc_mpi_find_hosts <outputfile>
|
|
Packit Service |
c5cf8c |
* The complete architecture is needed since the sub architecture use data from it.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* \param arch Pointer to the Scotch arch that will be built.
|
|
Packit Service |
c5cf8c |
* \param subarch Pointer to the Scotch sub arch that will be built.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* \returns 0 on success
|
|
Packit Service |
c5cf8c |
* \returns NETLOC_ERROR on error
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
int netlocscotch_build_current_arch(SCOTCH_Arch *arch, SCOTCH_Arch *subarch);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/**
|
|
Packit Service |
c5cf8c |
* \brief Give a good mapping with Scotch from a file containing a
|
|
Packit Service |
c5cf8c |
* communication matrix
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* This function reads the file about available resources, found by reading the
|
|
Packit Service |
c5cf8c |
* environment variable NETLOC_CURRENTSLOTS. The file must be generated before
|
|
Packit Service |
c5cf8c |
* calling the program running this functions with: mpirun -np <nprocs>
|
|
Packit Service |
c5cf8c |
* netloc_mpi_find_hosts <outputfile>
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* An application graph is built from the communication matrix and is mapped to
|
|
Packit Service |
c5cf8c |
* the architecture graph built from the resource file.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* \param[in] filename Filename of the matrix file, where the matrix is stored line
|
|
Packit Service |
c5cf8c |
* by line with spaces between values.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* \param[out] pnum_processes Pointer to the integer where th number of processes
|
|
Packit Service |
c5cf8c |
* will be written.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* \param[out] pcores Array of pnum_processes elements.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* \returns 0 on succes
|
|
Packit Service |
c5cf8c |
* \returns NETLOC_ERROR on error
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
int netlocscotch_get_mapping_from_comm_file(char *filename, int *pnum_processes,
|
|
Packit Service |
c5cf8c |
netlocscotch_core_t **pcores);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/**
|
|
Packit Service |
c5cf8c |
* \brief Give a good mapping with Scotch from a communication matrix
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* This function reads the file about available resources, found by reading the
|
|
Packit Service |
c5cf8c |
* environment variable NETLOC_CURRENTSLOTS. The file must be generated before
|
|
Packit Service |
c5cf8c |
* calling the program running this functions with: mpirun -np <nprocs>
|
|
Packit Service |
c5cf8c |
* netloc_mpi_find_hosts <outputfile>
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* An application graph is built from the communication matrix and is mapped to
|
|
Packit Service |
c5cf8c |
* the architecture graph built from the resource file.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* \param[in] comm pointer to the lines of the matrix of communications.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* \param[in] num_vertices number of processes, that corresponds to the size of
|
|
Packit Service |
c5cf8c |
* the matrix.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* \param[out] pcores Array of num_vertices elements.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* \returns 0 on success
|
|
Packit Service |
c5cf8c |
* \returns NETLOC_ERROR on error
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
int netlocscotch_get_mapping_from_comm_matrix(double **comm, int num_vertices,
|
|
Packit Service |
c5cf8c |
netlocscotch_core_t **pcores);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#ifdef __cplusplus
|
|
Packit Service |
c5cf8c |
} /* extern "C" */
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/** @} */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#endif // _NETLOC_H_
|