Hi Karl- sorry for the long response- recently moved and things have been up in the air. Yep that works on my machine.
Thank you very much as always for the help.. I should have seen too- I think I've just been writing directly to the GPU memory in the Matrices, and completely forgot that we needed to swap if that is not the case. Thank you very much, Andy ________________________________ From: Karl Rupp <r...@iue.tuwien.ac.at> Sent: Friday, October 21, 2016 2:25:51 PM To: Andrew Palumbo; viennacl-devel@lists.sourceforge.net Subject: Re: [ViennaCL-devel] Fw: Matrix * Vector CL_OUT_OF_RESOURCES error Hi Andy, apparently I was completely bananas and couldn't see the more fundamental problem with the code. I could reproduce the issue on my laptop (I'm on travel) and after finding the cause, I wonder why it didn't fail on my other machine. The reason for the problem is the initialization of the matrix A and the vector B: If you pass in a pointer to host memory, you *must* specify the memory type as viennacl::MAIN_MEMORY. To convert the data to OpenCL, switch to the OpenCL context via the member function .switch_memory_context(). It is not possible to use host data directly with OpenCL in general, because host memory and device memory can be physically distinct. (ignoring some possible pointer sharing on certain OpenCL devices here) The corrected code is attached. Please have a look at how A and B are initialized and how their memory context is changed to OpenCL after creation. Use viennacl::copy() or viennacl::fast_copy() to bring the data back to one of your host buffers. Sorry for not spotting this earlier... Best regards, Karli On 10/12/2016 06:25 AM, Andrew Palumbo wrote: > Hi Karl, > > As I mentioned before, I'm using libviennacl-dev version 1.7.1 installed > from the ubunto repo. > > > > When I run your attached code, I get do get an error: > > > andrew@michael:~/Downloads$ g++ DenseVectorMmul.cpp > -I/usr/include/viennacl/ -lOpenCL -o denseVec > > andrew@michael:~/Downloads$ ./denseVec > terminate called after throwing an instance of 'viennacl::memory_exception' > what(): ViennaCL: Internal memory error: not initialised! > Aborted (core dumped) > > andrew@michael:~/Downloads$ g++ --version > g++ (Ubuntu 5.4.0-6ubuntu1~16.04.2) 5.4.0 20160609 > Copyright (C) 2015 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > Thanks, > > > Andy > > > > > > ------------------------------------------------------------------------ > *From:* Karl Rupp <r...@iue.tuwien.ac.at> > *Sent:* Tuesday, October 11, 2016 10:31 AM > *To:* Andrew Palumbo; viennacl-devel@lists.sourceforge.net > *Subject:* Re: [ViennaCL-devel] Fw: Matrix * Vector CL_OUT_OF_RESOURCES > error > > Hi Andy, > > thanks for the reminder and sorry for not getting back to you sooner. > > After replacing the dynamically-sized arrays with std::vector<double>, I > compiled the code you provided and can execute it without problems. The > code is also valgrind-clean, so I don't know what could possibly be the > problem. > > Can you please verify two things: > a) you use the latest code from the master branch? > b) does the error show up with the attached code? It contains the > fixes for std::vector<>. The reason for the change is that my compiler > (GCC 4.6) did error out with the following: > > DenseVectorMmul.cpp: In function ‘int main()’: > DenseVectorMmul.cpp:32:30: error: variable-sized object ‘A_values’ may > not be initialized > DenseVectorMmul.cpp:45:26: error: variable-sized object ‘B_values’ may > not be initialized > > > Best regards, > Karli
------------------------------------------------------------------------------
_______________________________________________ ViennaCL-devel mailing list ViennaCL-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/viennacl-devel