schwz  Generated automatically from develop
process_topology.hpp (5a15602)
1 
2 /*******************************<SCHWARZ LIB LICENSE>***********************
3 Copyright (c) 2019, the SCHWARZ LIB authors
4 All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions
8 are met:
9 
10 1. Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright
14 notice, this list of conditions and the following disclaimer in the
15 documentation and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its
18 contributors may be used to endorse or promote products derived from
19 this software without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 ******************************<SCHWARZ LIB LICENSE>*************************/
33 
34 // This is a modified version of the topology example given in
35 // the hwloc documentation
36 // https://www.open-mpi.org/projects/hwloc/doc/v2.0.4/a00312.php#interface
37 
38 #ifndef process_topology_hpp
39 #define process_topology_hpp
40 
41 
42 #include <mpi.h>
43 #include <omp.h>
44 
45 
46 #include <ginkgo/ginkgo.hpp>
47 #include <schwarz/config.hpp>
48 
49 
50 #if SCHW_HAVE_CUDA
51 #include <cuda_runtime.h>
52 #endif
53 
54 
55 #include "device_guard.hpp"
56 
57 
64 namespace ProcessTopology {
65 
66 
67 static void bind_gpus_to_process(
68  std::shared_ptr<schwz::device_guard> &dev_guard, int &local_rank,
69  int &local_num_procs, int &num_threads)
70 {
71  // SCHWARZ_ASSERT_NO_CUDA_ERRORS(cudaSetDevice(local_rank));
72  // SCHWARZ_ASSERT_NO_CUDA_ERRORS(cudaGetLastError());
73 }
74 
75 
76 } // namespace ProcessTopology
77 
78 
79 #endif // process_topology.hpp
The ProcessTopology namespace .
Definition: process_topology.hpp:64