fml  0.1-0
Fused Matrix Library
gpu.hh
1 // This file is part of fml which is released under the Boost Software
2 // License, Version 1.0. See accompanying file LICENSE or copy at
3 // https://www.boost.org/LICENSE_1_0.txt
4 
5 #ifndef FML_PAR_GPU_H
6 #define FML_PAR_GPU_H
7 #pragma once
8 
9 
10 #include "internals/parmat.hh"
11 #include "gpu/parmat.hh"
12 #include "cpu/copy.hh"
13 
14 
15 namespace fml
16 {
30  inline int get_device_num(const comm &c)
31  {
32  int ngpus = get_device_count();
33  // if (c.localsize() > ngpus)
34  // throw std::runtime_error("parmat_gpu can not be used with more MPI ranks than GPUs per node");
35 
36  return c.rank() % ngpus;
37  }
38 }
39 
40 
41 #endif
fml::get_device_num
int get_device_num(const comm &c)
Returns the device number of the GPU to use with the calling MPI process.
Definition: gpu.hh:30
fml::comm
MPI communicator data and helpers.
Definition: comm.hh:24
fml
Core namespace.
Definition: dimops.hh:10
fml::get_device_count
int get_device_count()
Return number of GPU devices.
Definition: card.hh:19