Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 09:18:25

0001 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
0002 /*
0003  * Copyright (c) 2007-2008 Cisco Systems, Inc.  All rights reserved.
0004  *
0005  * Copyright (c) 2015-2018 Research Organization for Information Science
0006  *                         and Technology (RIST). All rights reserved.
0007  * Copyright (c) 2018-2020 Intel, Inc.  All rights reserved.
0008  * Copyright (c) 2021-2024 Nanook Consulting  All rights reserved.
0009  * Copyright (c) 2022      Triad National Security, LLC. All rights reserved.
0010  * $COPYRIGHT$
0011  *
0012  * Additional copyrights may follow
0013  *
0014  * $HEADER$
0015  */
0016 
0017 /**
0018  * @file
0019  *
0020  * This interface is for use by PMIx  to obtain topology-related info
0021  *
0022  */
0023 
0024 #ifndef PMIX_HWLOC_H
0025 #define PMIX_HWLOC_H
0026 
0027 #include "src/include/pmix_config.h"
0028 
0029 #include <hwloc.h>
0030 
0031 #include "pmix_common.h"
0032 
0033 #include "src/class/pmix_list.h"
0034 #include "src/include/pmix_globals.h"
0035 #include "src/mca/base/pmix_mca_base_framework.h"
0036 #include "src/mca/base/pmix_mca_base_var.h"
0037 #include "src/mca/mca.h"
0038 #include "src/server/pmix_server_ops.h"
0039 
0040 BEGIN_C_DECLS
0041 
0042 /**
0043  * Register params
0044  */
0045 PMIX_EXPORT pmix_status_t pmix_hwloc_register(void);
0046 
0047 /**
0048  * Finalize. Tear down any allocated storage
0049  */
0050 PMIX_EXPORT void pmix_hwloc_finalize(void);
0051 
0052 /* Setup the topology for delivery to clients */
0053 PMIX_EXPORT pmix_status_t pmix_hwloc_setup_topology(pmix_info_t *info, size_t ninfo);
0054 
0055 /* Load the topology */
0056 PMIX_EXPORT pmix_status_t pmix_hwloc_load_topology(pmix_topology_t *topo);
0057 
0058 /* Generate the string representation of a cpuset */
0059 PMIX_EXPORT pmix_status_t pmix_hwloc_generate_cpuset_string(const pmix_cpuset_t *cpuset,
0060                                                             char **cpuset_string);
0061 
0062 /* get cpuset from its string representation */
0063 PMIX_EXPORT pmix_status_t pmix_hwloc_parse_cpuset_string(const char *cpuset_string, pmix_cpuset_t *cpuset);
0064 
0065 /* Get locality string */
0066 PMIX_EXPORT pmix_status_t pmix_hwloc_generate_locality_string(const pmix_cpuset_t *cpuset, char **loc);
0067 
0068 /* Get relative locality */
0069 PMIX_EXPORT pmix_status_t pmix_hwloc_get_relative_locality(const char *locality1,
0070                                                            const char *locality2,
0071                                                            pmix_locality_t *loc);
0072 
0073 /* Get current bound location */
0074 PMIX_EXPORT pmix_status_t pmix_hwloc_get_cpuset(pmix_cpuset_t *cpuset, pmix_bind_envelope_t ref);
0075 
0076 /* Get distance array */
0077 PMIX_EXPORT pmix_status_t pmix_hwloc_compute_distances(pmix_topology_t *topo, pmix_cpuset_t *cpuset,
0078                                                        pmix_info_t info[], size_t ninfo,
0079                                                        pmix_device_distance_t **dist, size_t *ndist);
0080 
0081 PMIX_EXPORT pmix_status_t pmix_hwloc_check_vendor(pmix_topology_t *topo,
0082                                                   unsigned short vendorID,
0083                                                   uint16_t class);
0084 
0085 /* cpuset pack/unpack/copy/print functions */
0086 PMIX_EXPORT pmix_status_t pmix_hwloc_pack_cpuset(pmix_buffer_t *buf, pmix_cpuset_t *src,
0087                                                  pmix_pointer_array_t *regtypes);
0088 
0089 PMIX_EXPORT pmix_status_t pmix_hwloc_unpack_cpuset(pmix_buffer_t *buf, pmix_cpuset_t *dest,
0090                                                    pmix_pointer_array_t *regtypes);
0091 
0092 PMIX_EXPORT pmix_status_t pmix_hwloc_copy_cpuset(pmix_cpuset_t *dest, pmix_cpuset_t *src);
0093 
0094 PMIX_EXPORT char *pmix_hwloc_print_cpuset(pmix_cpuset_t *src);
0095 
0096 PMIX_EXPORT void pmix_hwloc_destruct_cpuset(pmix_cpuset_t *cpuset);
0097 
0098 PMIX_EXPORT void pmix_hwloc_release_cpuset(pmix_cpuset_t *ptr, size_t sz);
0099 
0100 PMIX_EXPORT pmix_status_t pmix_hwloc_get_cpuset_size(pmix_cpuset_t *ptr, size_t *sz);
0101 
0102 /* topology pack/unpack/copy/print functions */
0103 PMIX_EXPORT pmix_status_t pmix_hwloc_pack_topology(pmix_buffer_t *buf, pmix_topology_t *src,
0104                                                    pmix_pointer_array_t *regtypes);
0105 
0106 PMIX_EXPORT pmix_status_t pmix_hwloc_unpack_topology(pmix_buffer_t *buf, pmix_topology_t *dest,
0107                                                      pmix_pointer_array_t *regtypes);
0108 
0109 PMIX_EXPORT pmix_status_t pmix_hwloc_copy_topology(pmix_topology_t *dest, pmix_topology_t *src);
0110 
0111 PMIX_EXPORT char *pmix_hwloc_print_topology(pmix_topology_t *src);
0112 
0113 PMIX_EXPORT void pmix_hwloc_destruct_topology(pmix_topology_t *ptr);
0114 
0115 PMIX_EXPORT void pmix_hwloc_release_topology(pmix_topology_t *ptr, size_t sz);
0116 
0117 PMIX_EXPORT pmix_status_t pmix_hwloc_get_topology_size(pmix_topology_t *ptr, size_t *sz);
0118 
0119 /****  PRESERVE ABI  ****/
0120 PMIX_EXPORT void pmix_ploc_base_destruct_cpuset(pmix_cpuset_t *cpuset);
0121 PMIX_EXPORT void pmix_ploc_base_release_cpuset(pmix_cpuset_t *ptr, size_t sz);
0122 PMIX_EXPORT void pmix_ploc_base_destruct_topology(pmix_topology_t *ptr);
0123 PMIX_EXPORT void pmix_ploc_base_release_topology(pmix_topology_t *ptr, size_t sz);
0124 
0125 END_C_DECLS
0126 
0127 #endif