Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:47:20

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-2022 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 #if HWLOC_API_VERSION < 0x20000
0043 
0044 #    ifndef HAVE_HWLOC_TOPOLOGY_DUP
0045 #        define HAVE_HWLOC_TOPOLOGY_DUP 0
0046 #    endif
0047 
0048 #    define HWLOC_OBJ_L3CACHE HWLOC_OBJ_CACHE
0049 #    define HWLOC_OBJ_L2CACHE HWLOC_OBJ_CACHE
0050 #    define HWLOC_OBJ_L1CACHE HWLOC_OBJ_CACHE
0051 
0052 #    if HWLOC_API_VERSION < 0x10b00
0053 #        define HWLOC_OBJ_NUMANODE HWLOC_OBJ_NODE
0054 #        define HWLOC_OBJ_PACKAGE  HWLOC_OBJ_SOCKET
0055 #    endif
0056 
0057 #    define HAVE_DECL_HWLOC_OBJ_OSDEV_COPROC 0
0058 
0059 #else
0060 
0061 #    define HAVE_DECL_HWLOC_OBJ_OSDEV_COPROC 1
0062 
0063 #endif
0064 
0065 /**
0066  * Register params
0067  */
0068 PMIX_EXPORT pmix_status_t pmix_hwloc_register(void);
0069 
0070 /**
0071  * Finalize. Tear down any allocated storage
0072  */
0073 PMIX_EXPORT void pmix_hwloc_finalize(void);
0074 
0075 /* Setup the topology for delivery to clients */
0076 PMIX_EXPORT pmix_status_t pmix_hwloc_setup_topology(pmix_info_t *info, size_t ninfo);
0077 
0078 /* Load the topology */
0079 PMIX_EXPORT pmix_status_t pmix_hwloc_load_topology(pmix_topology_t *topo);
0080 
0081 /* Generate the string representation of a cpuset */
0082 PMIX_EXPORT pmix_status_t pmix_hwloc_generate_cpuset_string(const pmix_cpuset_t *cpuset,
0083                                                             char **cpuset_string);
0084 
0085 /* get cpuset from its string representation */
0086 PMIX_EXPORT pmix_status_t pmix_hwloc_parse_cpuset_string(const char *cpuset_string, pmix_cpuset_t *cpuset);
0087 
0088 /* Get locality string */
0089 PMIX_EXPORT pmix_status_t pmix_hwloc_generate_locality_string(const pmix_cpuset_t *cpuset, char **loc);
0090 
0091 /* Get relative locality */
0092 PMIX_EXPORT pmix_status_t pmix_hwloc_get_relative_locality(const char *locality1,
0093                                                            const char *locality2,
0094                                                            pmix_locality_t *loc);
0095 
0096 /* Get current bound location */
0097 PMIX_EXPORT pmix_status_t pmix_hwloc_get_cpuset(pmix_cpuset_t *cpuset, pmix_bind_envelope_t ref);
0098 
0099 /* Get distance array */
0100 PMIX_EXPORT pmix_status_t pmix_hwloc_compute_distances(pmix_topology_t *topo, pmix_cpuset_t *cpuset,
0101                                                        pmix_info_t info[], size_t ninfo,
0102                                                        pmix_device_distance_t **dist, size_t *ndist);
0103 
0104 PMIX_EXPORT pmix_status_t pmix_hwloc_check_vendor(pmix_topology_t *topo,
0105                                                   unsigned short vendorID,
0106                                                   uint16_t class);
0107 
0108 /* cpuset pack/unpack/copy/print functions */
0109 PMIX_EXPORT pmix_status_t pmix_hwloc_pack_cpuset(pmix_buffer_t *buf, pmix_cpuset_t *src,
0110                                                  pmix_pointer_array_t *regtypes);
0111 
0112 PMIX_EXPORT pmix_status_t pmix_hwloc_unpack_cpuset(pmix_buffer_t *buf, pmix_cpuset_t *dest,
0113                                                    pmix_pointer_array_t *regtypes);
0114 
0115 PMIX_EXPORT pmix_status_t pmix_hwloc_copy_cpuset(pmix_cpuset_t *dest, pmix_cpuset_t *src);
0116 
0117 PMIX_EXPORT char *pmix_hwloc_print_cpuset(pmix_cpuset_t *src);
0118 
0119 PMIX_EXPORT void pmix_hwloc_destruct_cpuset(pmix_cpuset_t *cpuset);
0120 
0121 PMIX_EXPORT void pmix_hwloc_release_cpuset(pmix_cpuset_t *ptr, size_t sz);
0122 
0123 PMIX_EXPORT pmix_status_t pmix_hwloc_get_cpuset_size(pmix_cpuset_t *ptr, size_t *sz);
0124 
0125 /* topology pack/unpack/copy/print functions */
0126 PMIX_EXPORT pmix_status_t pmix_hwloc_pack_topology(pmix_buffer_t *buf, pmix_topology_t *src,
0127                                                    pmix_pointer_array_t *regtypes);
0128 
0129 PMIX_EXPORT pmix_status_t pmix_hwloc_unpack_topology(pmix_buffer_t *buf, pmix_topology_t *dest,
0130                                                      pmix_pointer_array_t *regtypes);
0131 
0132 PMIX_EXPORT pmix_status_t pmix_hwloc_copy_topology(pmix_topology_t *dest, pmix_topology_t *src);
0133 
0134 PMIX_EXPORT char *pmix_hwloc_print_topology(pmix_topology_t *src);
0135 
0136 PMIX_EXPORT void pmix_hwloc_destruct_topology(pmix_topology_t *ptr);
0137 
0138 PMIX_EXPORT void pmix_hwloc_release_topology(pmix_topology_t *ptr, size_t sz);
0139 
0140 PMIX_EXPORT pmix_status_t pmix_hwloc_get_topology_size(pmix_topology_t *ptr, size_t *sz);
0141 
0142 /****  PRESERVE ABI  ****/
0143 PMIX_EXPORT void pmix_ploc_base_destruct_cpuset(pmix_cpuset_t *cpuset);
0144 PMIX_EXPORT void pmix_ploc_base_release_cpuset(pmix_cpuset_t *ptr, size_t sz);
0145 PMIX_EXPORT void pmix_ploc_base_destruct_topology(pmix_topology_t *ptr);
0146 PMIX_EXPORT void pmix_ploc_base_release_topology(pmix_topology_t *ptr, size_t sz);
0147 
0148 END_C_DECLS
0149 
0150 #endif