[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: OpenMP in oct files
From: |
Daniel Kraft |
Subject: |
Re: OpenMP in oct files |
Date: |
Mon, 23 Sep 2013 13:24:46 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 |
Hi again,
On 2013-09-23 13:13, Mike Puglia wrote:
> I'm certainly no expert in this, so I'm not sure I can answer your
> questions well, but I had almost the same problems getting openmp to
> work in Octave as well. I don't know how the matrix classes are
> written, but I assume when you start accessing a matrix from multiple
> threads at the same time there will be a problem with pointers flying
> all over at least. I tried to parallelize a few very simple for loops
> that acted on a (octave) matrix class and all I can say is the result
> was unstable. Although all of the for loops were pretty similar, I had
> cases where the parallel loop worked flawlessly with the expected
> accelerations, I had cases where the loops worked flawlessly but with no
> acceleration (though multiple threads were active) and I had cases where
> the results were incorrect. I don't think I had any problems with
> crashing however. After looking into it I'm pretty sure that I wasn't
> making any of the basic mistakes for working with openmp. All of the
> loops were pretty simple and should have had the same behavior (i.e.
> they all work or they all don't work, they are all accelerated or they
> are all not accelerated). That was not the case however. I'm sure
> someone with better knowledge of the matrix classes can explain why, but
> I eventually gave up on it.
thanks for confirming my results. :) I read already multiple times that
Octave is far from being thread-safe, thus my suspicion is indeed that
this is the problem. (Even though it seems to me that the basic matrix
classes are effectively hard to make *not* thread-safe.)
My code should of course be fine for parallelisation (no wrong data
dependencies), but I think I'll just try to rewrite the relevant
sections without using Octave routines at all and see if that helps.
With Fortran it should be more or less straight-forward to replace the
Octave classes, and it works very well to link to Fortran from oct-files
(I already did that in the past successfully).
> Regarding CUDA, I'm just starting to work on that myself. Did you use
> the VS2010 build by any chance? If not, how did you link with the nvcc
> compiler output?
Take a look at [1], which is the seminar report I wrote about my
experiments. I have to admit that I never used CUDA for anything "real"
so far (apart from those toy experiments). I worked on GNU/Linux with
nvcc. The basic idea is the same, just compile the CUDA code with nvcc
into a shared library and use it from the oct-file code.
[1] http://www.domob.eu/research/OctaveGPU.pdf
Yours,
Daniel
--
http://www.domob.eu/
--
Done: Arc-Bar-Cav-Hea-Kni-Ran-Rog-Sam-Tou-Val-Wiz
To go: Mon-Pri