openmp

Fortran OpenMP with subroutines and functions

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Disclaimer: I'm quite certain that this has been answered somewhere, but myself and another person have been searching quite hard to no avail. I've got a code that looks something like this: PROGRAM main !$omp parallel do !$omp private(somestuff) shared(otherstuff) DO i=1,n ... CALL mysubroutine(args) ... a=myfunction(moreargs) ... ENDDO !$omp end parallel do END PROGRAM SUBROUTINE mysubroutine(things) ... END SUBROUTINE FUNCTION myfunction(morethings) ... END FUNCTION I cannot determine where/how to handle private, shared, reduction, etc.

data members in an OpenMP loop

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have the following class: Class L{ public: bool foo(vector<bool> & data); private: C** cArray; } and would like to parallelize the for loop in the function foo which is called somtime after an object of L is created and all the elements in cArray are initialized. bool L::foo(vector<int> & data){ int row, col; #pragma omp parallel shared(SIZE, cArray, data) private(row, col) for (row=0, row<SIZE; ++row) { for (col=0; col<SIZE; ++col) { cArray[row][col].computeScore(data); } } } But this gives an error: error C3028: 'L::cArray' : only a

OpenMP and GSL RNG - Performance Issue - 4 threads implementation 10x slower than pure sequential one (quadcore CPU)

匿名 (未验证) 提交于 2019-12-03 08:44:33
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to turn a C project of mine from sequential into parallel programming. Although most of the code has now been redesigned from scratch for this purpose, the generation of random numbers is still at its core. Thus, bad performance of the random number generator (RNG) affects very badly the overall performance of the program. I wrote some code lines (see below) to show the problem I am facing without much verbosity. The problem is the following: everytime the number of threads nt increases, the performance gets singnificantly worse.

Compiling OpenMP code to C code

匿名 (未验证) 提交于 2019-12-03 08:41:19
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is there a way I can compile code with OpenMP to C code (With OpenMP part translated to plain C), so that I can know what kind of code is being generated by OpenMP. I am using gcc 4.4 compiler. 回答1: There is at least http://www2.cs.uh.edu/~openuh/ OpenUH (even listed at http://openmp.org/wp/openmp-compilers/ ), which can emit optimized C or Fortran 77 code that may be compiled by a native compiler on other platforms. Also there are: http://www.cs.uoi.gr/~ompi/ OMPi: The OMPi compiler takes C source code with OpenMP #pragmas and produces

OpenMP tasks in Visual Studio

匿名 (未验证) 提交于 2019-12-03 08:36:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to learn OMP library task based programming and as an example I copied and pasted the code below taken from a book and it outputs errors 'task' : expected an OpenMP directive name and 'taskwait' : expected an OpenMP directive name I can run omp parallel for loops but not tasks. Do you know whether omp tasking needs any further adjustments in visual studio? #include "stdafx.h" #include <omp.h> int fib(int n) { int i, j; if (n<2) return n; else { #pragma omp task shared(i) firstprivate(n) i=fib(n-1); #pragma omp task shared(j)

Cython: make prange parallelization thread-safe

流过昼夜 提交于 2019-12-03 08:25:19
Cython starter here. I am trying to speed up a calculation of a certain pairwise statistic (in several bins) by using multiple threads. In particular, I am using prange from cython.parallel, which internally uses openMP. The following minimal example illustrates the problem (compilation via Jupyter notebook Cython magic). Notebook setup: %load_ext Cython import numpy as np Cython code: %%cython --compile-args=-fopenmp --link-args=-fopenmp -a from cython cimport boundscheck import numpy as np from cython.parallel cimport prange, parallel @boundscheck(False) def my_parallel_statistic(double[:] X

MacOS, CMake and OpenMP

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using the newest CMake (3.9.3) from Homebrew along with LLVM 5.0.0 also from Brew, because Clang here has OpenMP support. This worked in CMake 3.8.2 with LLVM 5. In my CMakeLists.txt I have find_package( OpenMP ) and later I want to do if( OpenMP_CXX_FOUND ) However CMake doesn't seem to pick up on the find_package directive. I run CMake with cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DUSE_WERROR=ON where I have checked that clang and clang++ points correctly to /usr/local/opt/llvm/bin/clang

Performance degradation of matrix multiplication of single vs double precision arrays on multi-core machine

 ̄綄美尐妖づ 提交于 2019-12-03 07:32:52
问题 UPDATE Unfortunately, due to my oversight, I had an older version of MKL (11.1) linked against numpy. Newer version of MKL (11.3.1) gives same performance in C and when called from python. What was obscuring things, was even if linking the compiled shared libraries explicitly with the newer MKL, and pointing through LD_* variables to them, and then in python doing import numpy, was somehow making python call old MKL libraries. Only by replacing in python lib folder all libmkl_*.so with newer

Does Qt support OpenMP?

。_饼干妹妹 提交于 2019-12-03 07:02:05
I am using OpenMP in my Visual Studio projects and currently thinking very seriously in changing to QT creator. (Doesn't Visual Studio suck?,I expect much more from Microsoft) But anyway... Does QT creator support OpenMP? In case of that, what should I do to enable it? Or maybe is enabled by default? Do I need to do something special? Thanks for your advices. Ignacio. Does QT creator support OpenMP? As someone else mentioned, it's not Qt itself that support OpenMP but the compiler. What should I do to enable it? If you have installed a recent Qt 4.6.x SDK (hint: latest QtCreator 1.3 is

Difference between linking OpenMP with -fopenmp and -lgomp

只谈情不闲聊 提交于 2019-12-03 06:41:25
I've been struggling a weird problem the last few days. We create some libraries using GCC 4.8 which link some of their dependencies statically - eg. log4cplus or boost. For these libraries we have created Python bindings using boost-python. Every time such a library used TLS (like log4cplus does in it's static initialization or stdlibc++ does when throwing an exception - not only during initialization phase) the whole thing crashed in a segfault - and every time the address of the thread local variable has been 0. I tried everything like recompiling, ensuring -fPIC is used, ensuring -tls