Provide useful routines for working with cpusets (on ALTX systems) and/or their Fortran interfaces
/lrz/sys/lib/liblrz_cpuset.a
/lrz/sys/include/lrz_cpuset.h
/lrz/sys/include/lrz_cpuset_f.h (for Fortran)
module load liblrz
icc/ifort ... $LIBLRZ_CPUSET_INC $LIBLRZ_CPUSET_LIB
Return the number of CPUs in the current tasks cpuset. The relative CPU numbers that are passed to the cpuset_pin() function and that are returned by the cpuset_where() function, must be between 0 and N - 1 inclusive, where N is the value returned by cpuset_size().
Return the CPU number, relative to the current tasks cpuset, of the CPU on which the current task most recently executed. If a task is allowed to execute on more than one CPU, then there is no guarantee that the task is still executing on the CPU returned by cpuset_where, by the time that the user code obtains the return value.
Pin the current task to execute only on the CPU relcpu, which is a relative CPU number within the current cpuset of that task. Also automatically pin the memory allowed to be used by the current task to the memory on that same node.
Example:
call mpi_init(ierr)
call mpi_comm_rank(mpi_comm_world,myrank,ierr)
call mpi_comm_size(mpi_comm_world,mysize,ierr)
!$omp parallel
ithreads=omp_get_num_threads()
!$omp end parallel
!$omp parallel do ordered private(j,ierr)
do j=0,ithreads-1
Ierr=cpuset_pin(myrank*ithreads+j)
enddo
Remove the CPU and Memory pinning affects of any previous cpuset_pin call, allowing the current task to execute on any CPU in its current cpuset and to allocate memory on any Memory Node in its current cpuset.
gettid() returns the thread ID (light weight process, or thread) of the current process. This is equal to the process ID (as returned by getpid(2)), unless the process is part of a thread group (created by specifying the CLONE_THREAD flag to the clone(2) system call). All processes in the same thread group have the same PID, but each one has a unique TID.
Return the ab solute CPU number, which the current task most recently executed.
Return the absolute CPU on which a thread can run. If more than one CPU is possible, the negatvie number of the highest possible CPU is returned. also a cpumask, containing 0 and 1, is returned, showing on which CPUs a thread may execute. len is the dimension of the cpu_mask, i.e. the number of processors in a partition.