bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] Multi-core functions


From: Elias Mårtenson
Subject: Re: [Bug-apl] Multi-core functions
Date: Fri, 4 Apr 2014 22:53:21 +0800

OK, I understand.

I did find this, which is probably a good thing to use. It includes the correct detection mechanism for Solaris as well.

Regards,
Elias


On 4 April 2014 22:50, Juergen Sauermann <address@hidden> wrote:
Hi,

maybe later if the stuff is more stable. The autoconf checks are
already there, its just a matter of changing the default later on.

/// Jürgen



On 04/04/2014 04:31 PM, Elias Mårtenson wrote:
Wouldn't it make sense to check for OMP and enable it if it's found? I'm currently looking into autoconf to figure out a way to do this. Are you willing to take the patch if I do that?

Regards,
Elias


On 4 April 2014 22:30, Juergen Sauermann <address@hidden> wrote:
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.

Regards,
Elias


On 4 April 2014 21:58, Juergen Sauermann <address@hidden> wrote:
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










reply via email to

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