Commit ce5f476b authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

MPI: added output to the selectGPU function for easier debugging

parent acb342cc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
/***************************************************************************
                          MPI/Wrappers.h  -  description
                          MPI/Utils.h  -  description
                             -------------------
    begin                : Apr 23, 2005
    copyright            : (C) 2005 by Tomas Oberhuber et al.
+7 −1
Original line number Diff line number Diff line
/***************************************************************************
                          MPI/Wrappers.h  -  description
                          MPI/selectGPU.h  -  description
                             -------------------
    begin                : Apr 23, 2005
    copyright            : (C) 2005 by Tomas Oberhuber et al.
@@ -10,6 +10,8 @@

#pragma once

#include <cstdlib>  // std::getenv

#include <TNL/Cuda/CheckDevice.h>

#include "Utils.h"
@@ -26,6 +28,10 @@ inline void selectGPU()

   const int local_rank = getRankOnNode();
   const int gpuNumber = local_rank % gpuCount;
   std::cout << "Rank " << GetRank() << ": rank on node is " << local_rank
             << ", using GPU id " << gpuNumber << " of " << gpuCount
             << ", CUDA_VISIBLE_DEVICES=" << std::getenv("CUDA_VISIBLE_DEVICES")
             << std::endl;

   cudaSetDevice(gpuNumber);
   TNL_CHECK_CUDA_DEVICE;