alibParallel
Toggles parallel execution in RWalib at runtime (see the
RWalib Introduction for an overview). nonRWalib code is unaffected by this toggle. If RWalib is called from a section of parallel code,
alibParallel() should be used at the beginning and end of that section in order to disable and then re-enable parallel execution within RWalib.
Prototype
void alibParallel( wvlong y )
Parameters
y — (Input) Toggle 0/1 to disable/enable parallel execution in RWalib.
Example
First we disable parallel execution and show the otherwise default parameters. The parallelization threshold becomes LONG_MAX, disabling parallel execution. Next we re-enable parallel execution, show the parameters, and note that the parallelization threshold is back to its default value. Finally, we repeat the process but this time with non-default parameters from a tuning-file, and again we note that the parallelization threshold is the only parameter which changes. Recall from the introduction that without ATC this parallelization threshold applies to all operations, but with ATC it represents the minimum from a set of operation-specific thresholds.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "alib.h"
void main() {
alibinit( NULL, NULL, NULL, NULL );
printf( "show default params but with parallel execution disabled \n" );
alibParallel(0);
alibset( -1, -1, -1, -1, NULL, 1, NULL, NULL, NULL, NULL, NULL );
printf( "re-enable parallel execution and show params \n" );
alibParallel(1);
alibset( -1, -1, -1, -1, NULL, 1, NULL, NULL, NULL, NULL, NULL );
printf( "load tuning-file, disable parallel execution, show params \n" );
alibset( -1, -1, -1, -1, "loisln64", 0, NULL, NULL, NULL, NULL, NULL );
alibParallel(0);
alibset( -1, -1, -1, -1, NULL, 1, NULL, NULL, NULL, NULL, NULL );
printf( "re-enable parallel execution and show params \n" );
alibParallel(1);
alibset( -1, -1, -1, -1, NULL, 1, NULL, NULL, NULL, NULL, NULL );
}
Output:
show default params but with parallel execution disabled
OpenMP: Enabled
Processors: 24
Max Threads: 24
Threshold: 9223372036854775807
Tuning File:
OMP_auto: OFF
Dynamic Threads: OFF
cache line: 64
cache l1: 32768
cache l2: 262144
cache l3: 8388608
cache l4: 67108864
re-enable parallel execution and show params
OpenMP: Enabled
Processors: 24
Max Threads: 24
Threshold: 1000
Tuning File:
OMP_auto: OFF
Dynamic Threads: OFF
cache line: 64
cache l1: 32768
cache l2: 262144
cache l3: 8388608
cache l4: 67108864
load tuning-file, disable parallel execution, show params
OpenMP: Enabled
Processors: 24
Max Threads: 24
Threshold: 9223372036854775807
Tuning File: loisln64
OMP_auto: ON
Dynamic Threads: OFF
cache line: 64
cache l1: 32768
cache l2: 262144
cache l3: 12582912
cache l4: 67108864
re-enable parallel execution and show params
OpenMP: Enabled
Processors: 24
Max Threads: 24
Threshold: 64
Tuning File: loisln64
OMP_auto: ON
Dynamic Threads: OFF
cache line: 64
cache l1: 32768
cache l2: 262144
cache l3: 12582912
cache l4: 67108864
Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.