[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] Multi-core functions

From: Juergen Sauermann
Subject: Re: [Bug-apl] Multi-core functions
Date: Fri, 04 Apr 2014 16:30:06 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130330 Thunderbird/17.0.5

Hi Elias,

if you ./configure nothing then MULTICORE will be #undef'ed and that
means OMP will be disabled. This is the default for backward compatibility
so that GNU APL still compiles even if you don't have OMP installed.

For the behavior that you expect below,

    .,/configure CORE_COUNT_WANTED=all

is the way to go.

/// Jürgen

On 04/04/2014 04:15 PM, Elias Mårtenson wrote:
Cool, thanks for this!

Can you clarify one thing: If you don't specify anything on the command line, and also not specify anything at runtime, what will the default be?

Casually, I'd expect it to be set to OMP enabled, with the core count = the number of cores on the machine.


On 4 April 2014 21:58, Juergen Sauermann <address@hidden> wrote:

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

./configure CORE_COUNT_WANTED=0

no openMP support. Will


./configure CORE_COUNT_WANTED=-1 or =all

dynamic core count using all available cores. Will

#define MULTICORE 1

./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

./configure CORE_COUNT_WANTED=-3 or =syl

dynamic core count set in APL by ⎕SYL Will

#define MULTICORE 1

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]