[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-apl] Multi-core functions
From: |
Juergen Sauermann |
Subject: |
[Bug-apl] Multi-core functions |
Date: |
Fri, 04 Apr 2014 15:58:02 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130330 Thunderbird/17.0.5 |
Hi,
I have added a few functions to support multi-core/open MP programming
for GNU APL, (see SVN 184.
1. ./configure
You can now ./configure static and dynamic core counts:
./configure CORE_COUNT_WANTED=N with N>0
static maximum core count. Will
#define MULTICORE 1
#define STATIC_CORE_COUNT N
./configure CORE_COUNT_WANTED=0
no openMP support. Will
#undef MULTICORE
#define STATIC_CORE_COUNT 1
./configure CORE_COUNT_WANTED=-1 or =all
dynamic core count using all available cores. Will
#define MULTICORE 1
#undef STATIC_CORE_COUNT
./configure CORE_COUNT_WANTED=-2 or =argv
dynamic core count set by command line option --cc N.
Same as =all if --cc is not given. Will
#define MULTICORE 1
#undef STATIC_CORE_COUNT
./configure CORE_COUNT_WANTED=-3 or =syl
dynamic core count set in APL by ⎕SYL Will
#define MULTICORE 1
#undef STATIC_CORE_COUNT
The interpreter is started with core count 1.
Eg. ⎕SYL[26]←2 will set core count to 2.
⎕SYL[24;] is the core count used in in ./configure (read-only)
⎕SYL[25;] is the core count detected by pthread_getaffinity_np() (read-only)
⎕SYL[26;] is the current core count (read-only unless CORE_COUNT_WANTED=syl)
---------------------------------------------------------------------------------
In the interpreter code, the above #defines become available by:
#include "Common.hh"
That also declares the following functions/macros:
CoreCount core_count() // return number of cores that will be used
CoreCount max_cores() // return number of cores detected by
pthread_getaffinity_np()
CoreCount setup_cores(CoreCount new_count) // set new core count, return
min ( new_count, max_cores )
if STATIC_CORE_COUNT is #defined then core_count() is a macro expanding
to max ( CORE_COUNT_WANTED, 1).
In that case, max_cores() cores will be used and not core_count() cores!
./configure checks for presence of omp.h and libgomp and sets CXX flags
in Makefiles.
omp.h is #included by Common.hh if present and needed (ie. if MULTICORE
is 1)
/// Jürgen
- [Bug-apl] Multi-core functions,
Juergen Sauermann <=