PadicoTM

Documentation

« back to PM2 home.
fabric.c
Go to the documentation of this file.
1/*
2 * Padico -- a High Performance Parallel and Distributed Computing Environment
3 * Copyright (c) 2002-2024 INRIA and the University of Rennes 1
4 * Alexandre DENIS <Alexandre.Denis@inria.fr>
5 * Christian PEREZ <Christian.Perez@inria.fr>
6 *
7 * The software has been registered at the Agency for the Protection of
8 * Programs (APP) under the number IDDN.FR.001.260013.000.S.P.2002.000.10000.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
30#include <Padico/Puk.h>
31#include <Padico/Module.h>
32#include <Padico/Topology.h>
33
34#include <stdio.h>
35#include <unistd.h>
36#include <sys/stat.h>
37#include <sys/types.h>
38#include <string.h>
39
40#include <rdma/fabric.h>
41
42static int padico_libfabric_init(void);
43static void padico_libfabric_finalize(void);
44
46
47/* size for a CXI address in string format. 18 bytes should be enough; stay on the safe side */
48#define CXI_ADDR_SIZE 32
49
50/* ********************************************************* */
51
57
58static struct
59{
61} padico_libfabric = { .port = NULL };
62
63
64/* ********************************************************* */
65
66static int padico_libfabric_init(void)
67{
68 struct stat s;
69 int rc = stat("/dev/cxi0", &s);
70 if(!rc)
71 {
72 rc = stat("/sys/class/cxi/cxi0/device/net/hsn0/address", &s);
73 if(!rc)
74 {
75 /* hack to detect CXI address here, even though CXI is not documented.
76 * maybe we'd better simply use MAC address of hsn0 ethernet iface */
77 FILE*fd = fopen("/sys/class/cxi/cxi0/device/net/hsn0/address", "r");
78 char addr[CXI_ADDR_SIZE] = { '\0' };
79 fgets(addr, CXI_ADDR_SIZE, fd);
80 fclose(fd);
81 char*b = strchr(addr, '\n');
82 if(b)
83 {
84 *b = '\0';
85 }
86 padico_print("detected Cray CXI; address = %s\n", addr);
90 if(network)
91 {
93 }
94 else
95 {
97 }
100
101 }
102 else
103 {
104 padico_warning("detected Cray CXI but cannot read address.\n");
105 }
106 }
107 else
108 {
109 padico_warning("no network detected.\n");
110 }
111
112 return 0;
113}
114
116{
117 if(padico_libfabric.port != NULL)
118 {
120 }
121}
struct ns_rulebucket_hash_entry_s * b
return NULL
Definition Shm.h:88
uintptr_t s
Definition Shm.h:88
static int done
Definition console-mod.c:49
static int fd
Definition datacheck.c:32
static void padico_libfabric_finalize(void)
Definition fabric.c:115
static int padico_libfabric_init(void)
Definition fabric.c:66
static struct @29 padico_libfabric
struct padico_libfabric_port_s * port
port from where the packet is sent
Definition fabric.c:60
#define CXI_ADDR_SIZE
Definition fabric.c:48
padico_rc_t rc
Definition PadicoTM.h:146
padico_topo_network_t padico_topo_network_create(const char *id, padico_topo_binding_scope_t scope, size_t addr_size, int family)
Definition topology.c:1853
padico_topo_network_t padico_topo_network_getbyid(const char *network_id)
Definition topology.c:2351
#define padico_topo_getlocalhost()
Definition Topology.h:319
padico_topo_binding_t padico_topo_host_bind(padico_topo_host_t host, padico_topo_network_t network, const void *address)
Declare a new binding for a host.
Definition topology.c:1609
@ PADICO_TOPO_SCOPE_HOST
Definition Topology.h:95
padico_topo_network_t network
Definition psp-mx.c:113
padico_topo_network_t network
Definition fabric.c:55
a network, containing entities with bindings