Peano
Loading...
Searching...
No Matches
Core.h
Go to the documentation of this file.
1// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
5#include <set>
6#include <string>
7#include <thread>
8
9#include "tarch/logging/Log.h"
10
11namespace tarch {
12 namespace multicore {
13 class Core;
14
22
32 std::string printUnmaskedThreads();
33 } // namespace multicore
34} // namespace tarch
35
51private:
56
57 Core();
58
60
61public:
69 static constexpr int UseDefaultNumberOfThreads = 0;
70
74 ~Core();
75
79 static Core& getInstance();
80
98 void configure(int numberOfThreads = UseDefaultNumberOfThreads);
99
103 void shutdown();
104
110 bool isInitialised() const;
111
117 int getNumberOfThreads() const;
118
122 int getCoreNumber() const;
123
127 int getThreadNumber() const;
128
136 void yield();
137};
Log Device.
Definition Log.h:516
static constexpr int UseDefaultNumberOfThreads
The default is what the system management typically gives you.
Definition Core.h:69
bool isInitialised() const
Definition Core.cpp:65
~Core()
Destructor.
Definition Core.cpp:54
int getCoreNumber() const
Definition Core.cpp:69
static Core & getInstance()
Definition Core.cpp:56
int getNumberOfThreads() const
Returns the number of threads that is used.
Definition Core.cpp:67
static tarch::logging::Log _log
Logging device.
Definition Core.h:55
void configure(int numberOfThreads=UseDefaultNumberOfThreads)
Configure the whole node, i.e.
Definition Core.cpp:61
void shutdown()
Shutdown parallel environment.
Definition Core.cpp:63
int getThreadNumber() const
Definition Core.cpp:78
void yield()
Wrapper around backend-specific yield.
Definition Core.cpp:80
std::string printUnmaskedThreads()
Creates a string representation of those threads which are available to the processes.
Definition Core.cpp:11
int getNumberOfUnmaskedThreads()
This routine runs through the Unix thread mask and counts how many threads SLURM allows a code to use...
Definition Core.cpp:32
Have to include this header, as I need access to the SYCL_EXTERNAL keyword.
Definition accelerator.h:19