Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://www.mooseframework.org 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #include "KokkosHeader.h" 11 : #include "KokkosMemoryPool.h" 12 : 13 : #include "MooseApp.h" 14 : 15 : #include "libmesh/parallel_implementation.h" 16 : 17 : std::unique_ptr<Moose::Kokkos::MemoryPool> _pool; 18 : 19 : void 20 317 : MooseApp::queryKokkosGPUs() 21 : { 22 317 : unsigned int num_kokkos_gpus = Kokkos::num_devices(); 23 : 24 317 : comm().min(num_kokkos_gpus); 25 : 26 317 : _has_kokkos_gpus = num_kokkos_gpus > 0; 27 317 : } 28 : 29 : void 30 0 : MooseApp::allocateKokkosMemoryPool(std::size_t size, unsigned int ways) const 31 : { 32 0 : _pool = std::make_unique<Moose::Kokkos::MemoryPool>(size, ways); 33 0 : } 34 : 35 : void 36 42856 : MooseApp::deallocateKokkosMemoryPool() 37 : { 38 42856 : _pool.reset(); 39 42856 : } 40 : 41 : const Moose::Kokkos::MemoryPool & 42 0 : MooseApp::getKokkosMemoryPool() const 43 : { 44 0 : return *_pool; 45 : }