FastFlow
SVN-r182-Aug-14-2014
A high-level, lock-less, parallel programming (shared-memory) and distributed programming (distributed-memory) framework for multi-cores and many-cores systems
|
This file contains utilities for thread pinning to cores and thread mapping. More...
#include <iostream>
#include <errno.h>
#include <ff/config.hpp>
#include <stddef.h>
Functions | |
static long | ff_getThreadID () |
Returns the ID of the calling thread. More... | |
static unsigned long | ff_getCpuFreq () |
Returnes the frequency of the CPU. More... | |
static int | ff_numCores () |
Returns the number of cores in the system. More... | |
static int | ff_realNumCores () |
Returns the real number of cores in the system without considering HT or HMT. More... | |
static int | ff_numSockets () |
Returns the number of CPUs (physical sockets) on the system. More... | |
static int | ff_setPriority (int priority_level=0) |
Sets the scheduling priority. More... | |
static int | ff_getMyCore () |
Returns the ID of the core. More... | |
static int | ff_mapThreadToCpu (int cpu_id, int priority_level=0) |
Maps the calling thread to the given CPU. More... | |
This file contains utilities for thread pinning to cores and thread mapping.
This file provides support for thread pinning and mapping at linux and MacOS.
|
inlinestatic |
Returnes the frequency of the CPU.
It returns the frequency of the CPUs (On a shared memory system, all cores have the same frequency). It works on Linux OS and Apple OS.
|
inlinestatic |
Returns the ID of the core.
It returns the ID of the core where the calling thread is running. It works on Linux OS and Apple OS.
|
inlinestatic |
Returns the ID of the calling thread.
It returns the ID of the calling thread. It works on Linux OS, Apple OS, Windows.
|
inlinestatic |
Maps the calling thread to the given CPU.
It maps the calling thread to the given core. It works on Linux OS, Apple OS, Windows.
cpu_id | the ID of the CPU to which the thread will be attached. |
priority_level | TODO |
EINVAL
is returned. References ff_numCores(), and ff_setPriority().
|
inlinestatic |
Returns the number of cores in the system.
It returns the number of cores present in the system. (Note that it does take into account hyperthreading). It works on Linux OS, Apple OS and Windows.
|
inlinestatic |
Returns the number of CPUs (physical sockets) on the system.
It returns the number physical sockets on the system. It works on Linux OS.
|
inlinestatic |
Returns the real number of cores in the system without considering HT or HMT.
It returns the number of cores present in the system. It works on Linux OS
|
inlinestatic |
Sets the scheduling priority.
It sets the scheduling priority of the process (or thread). The priority_level is a value in the range -20 to 19. The default priority is 0, lower priorities cause more favorable scheduling.
MA: This should be redesigned since it might have different behaviours in different systems.
priority_level defines the level of the priority. Default is set to 0.