slang-devel mailing list

[2020 Date Index] [2020 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[slang-devel] s-lang and openmp


Dear all ;

Attached is an archive containing modified source files (from
slang-pre2.3.3-24) to allow some array based operations to be
parallelized via openmp. For now, arithmetic operations have been
parallelized (+, - ...), logic ones (&, | ...) and mathematic ones
(sin, cos...). I also made an attempt to parallelize the so usefull
"where" function. I didn't add a switch to configure script, so you
will have to modify the Makefile in source directory by adding
-fopenmp to CFLAGS and -lgomp to ELF_DEP_LIBS (see included Makefile).

Some test files are also included.
test_evaluate_functions.sl come from a test case described here [1].
I didn't run many comparisons with other languages yet, but from this
example, parallelized s-lang is faster than julia (!)

Obviously, there are some drawbacks. Speed benefit will depend on
array size, and on small ones, performance could be worse. This can
fixed by using OMP_NUM_THREADS environment variable. Openmp functions
may also be wrapped (omp_set_num_threads ()...)
Openmp sections could also be changed to something like :
#pragma omp parallel for if (parallelism_enabled)

I have only basic openmp knowledge and limited understanding of how
s-lang works, so I may have miss something important...

Let me know if you think it's worth going further in this direction.

Kind regards.


Laurent.



References :
------------
[1] https://modelingguru.nasa.gov/docs/DOC-2783

Attachment: slang_openmp.tgz
Description: application/gzip


[2020 date index] [2020 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]