Re: [ViennaCL-devel] Fw: Matrix * Vector CL_OUT_OF_RESOURCES error
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, 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
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, 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 #define VIENNACL_WITH_OPENCL #include "viennacl/context.hpp" #include "viennacl/matrix.hpp" #include "viennacl/tools/random.hpp" #include // C_vec = A_dense_matrix %*% B_vec. // compile line: g++ DenseVectorMmul.cpp -I/usr/include/viennacl/ -lOpenCL -o denseVec int main() { // trying to recreate javacpp wrapper functionalliy as closely as possible // so not using typedef, unsigned ints, etc, and defining templates as doubles // creating buffers as int/double arrays and then setting pointers to them. // (not 100% sure that this is how javacpp passes pointers but should be close.) //typedef double ScalarType; // using unsigned ints here to suppress warnings/errors w/o using -fpermissive` // in acuallity, we cast `int`s from jni/javacpp. unsigned int m = 200; unsigned int n = 100; // create an OpenCL context which we will pass directly to the constructors // of the Matrix and vector viennacl::context oclCtx(viennacl::OPENCL_MEMORY); std::vector A_values(m * n); viennacl::tools::uniform_random_numbers randomNumber; for (int i = 0; i < m * n; i++) { A_values[i] = randomNumber(); } double* A_values_ptr = &(A_values[0]); // this is currently the constructor that we're using through scala/javacpp. viennacl::matrix<double,viennacl::row_major> A_dense_matrix(A_values_ptr, viennacl::MAIN_MEMORY , m, n); A_dense_matrix.switch_memory_context(oclCtx); std::vector B_values(n); for (int i = 0; i < n; i++) { B_values[i] = randomNumber(); } double* B_values_ptr = &(B_values[0]); // this is currently the constructor that we're using through scala/javacpp. viennacl::vector B_vec(B_values_ptr, viennacl::MAIN_MEMORY, n, 0, 1); B_vec.switch_memory_context(oclCtx); // perform multiplication and pass result to a vector constructor viennacl::vector C_vec(viennacl::linalg::p
Re: [ViennaCL-devel] Fw: Matrix * Vector CL_OUT_OF_RESOURCES error
Interesting... Sorry I was mistaken again . I am running with the 1.7.0 library (just checked the version.hpp file) Thank you. Sent from my Verizon Wireless 4G LTE smartphone Original message From: Karl Rupp <r...@iue.tuwien.ac.at> Date: 10/12/2016 1:55 AM (GMT-08:00) To: Andrew Palumbo <ap@outlook.com>, viennacl-devel@lists.sourceforge.net Subject: Re: [ViennaCL-devel] Fw: Matrix * Vector CL_OUT_OF_RESOURCES error Hi Andy, > 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. Now things get weird: I can't reproduce the problem with neiter the current developer tip, the 1.7.1 release, and 1.7.0, GCC 4.6 and GCC 4.8. I'll replicate your environment (Ubuntu 16.04) and try it there. Best regards, Karli -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ ViennaCL-devel mailing list ViennaCL-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/viennacl-devel
Re: [ViennaCL-devel] Fw: Matrix * Vector CL_OUT_OF_RESOURCES error
Hi Andy, > 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. Now things get weird: I can't reproduce the problem with neiter the current developer tip, the 1.7.1 release, and 1.7.0, GCC 4.6 and GCC 4.8. I'll replicate your environment (Ubuntu 16.04) and try it there. Best regards, Karli -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ ViennaCL-devel mailing list ViennaCL-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/viennacl-devel
Re: [ViennaCL-devel] Fw: Matrix * Vector CL_OUT_OF_RESOURCES error
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, 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 On 10/11/2016 07:15 AM, Andrew Palumbo wrote: > Hi Karl, I was wondering if you'd had a chance to take a look at this? > > > Any help would be much appreciated. We're looking to do a mahout > release shortly and it would be great to have a ViennaCL vector > implementation included. > > > Thank you, > > > Andy > > > > *From:* Andrew Palumbo <ap@outlook.com> > *Sent:* Thursday, September 15, 2016 7:08:49 PM > *To:* Karl Rupp; viennacl-devel@lists.sourceforge.net > *Subject:* Re: [ViennaCL-devel] Fw: Matrix * Vector CL_OUT_OF_RESOURCES > error > > > > Thank you I apologize for the sloppiness. > > > with the correct compile line, I get: > > $ g++ DenseVectorMmul.cpp -I/usr/include/viennacl/ -lOpenCL -o denseVecs > > $ ./denseVecs > terminate called after throwing an instance of 'viennacl::memory_exception' > what(): ViennaCL: Internal memory error: not initialised! > Aborted (core dumped) > > Thanks, > > Andy > > > > *From:* Karl Rupp <r...@iue.tuwien.ac.at> > *Sent:* Thursday, September 15, 2016 6:46:40 PM > *To:* Andrew Palumbo; viennacl-devel@lists.sourceforge.net > *Subject:* Re: [ViennaCL-devel] Fw: Matrix * Vector CL_OUT_OF_RESOURCES > error > > Hi, > > these are linker errors. Add -lOpenCL. > If the OpenCL library is not available system-wide, also pass the the > location with the -L flag. > > :-) > > Best regards, > Karli > > > On 09/16/2016 12:08 AM, Andrew Palumbo wrote: >> >> Apologies for accidentally not replying to the list last email >> >> >> >> >> Thank you, Karl, I'd forgotten that because we have that Definition as >> part of the java cpp setup. >> >> >> With #define VIENNACL_WITH_OPENCL, though now I'm getting compile >> errors. Are there possibly missing includes? I've checked this against >> the blas2.cpp example, and don't see any missing. As well I cant seem >> to find the suggested imports that you recommended several weeks back. >> I've attached theu pdated .cpp file with the correct #define as well as >> pasted it below the partial error dump. >> >> >> Thanks again for your time, >> >> Andy >> >> >> >> g++ DenseVectorMmul.cpp -I/usr/include/viennacl/ -o denseVec >> /tmp/ccSoGpk2.o: In function >> `viennacl::ocl::handle_inc_dec_helper<_cl_mem*>::dec(_cl_mem*&)': >> DenseVectorMmul.cpp:(.text._ZN8viennacl3ocl21handle_inc_dec_helperIP7_cl_memE3decERS3_[_ZN8viennacl3ocl21handle_inc_dec_helperIP7_cl_memE3decERS3_]+0x17): >> undefined reference to `clReleaseMemObject' >> /tmp/ccSoGpk2.o: In function >> `viennacl::ocl::handle_inc_dec_helper<_cl_program*>::dec(_cl_program*&)': >
Re: [ViennaCL-devel] Fw: Matrix * Vector CL_OUT_OF_RESOURCES error
Sent from my Verizon Wireless 4G LTE smartphone Original message From: Karl Rupp <r...@iue.tuwien.ac.at> Date: 10/11/2016 10:10 AM (GMT-08:00) To: Andrew Palumbo <ap@outlook.com>, viennacl-devel@lists.sourceforge.net Subject: Re: [ViennaCL-devel] Fw: Matrix * Vector CL_OUT_OF_RESOURCES error Hi Andy, > Wrt to (a) I'm using the 1.7.2 release from installed by apt-get on > ununtu. So it's not the latest. Huh? The latest release is 1.7.1... Oops... long days and long nights.. been a while wince I looked at it so it's the latest release :) Will run the code tonight.. Thx > I will try running with the code you provided tonight. The problem is > that we use javacpp and so do not have access to stdlib as written > currently. Your original version should be fine, too. Either way, the STL-vector is of course not needed and just for testing :-) > I will run the c++ code tonight and let you know. Cheers! Best regards, Karli > > Original message > From: Karl Rupp <r...@iue.tuwien.ac.at> > Date: 10/11/2016 7:31 AM (GMT-08:00) > To: Andrew Palumbo <ap@outlook.com>, > 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, 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 > > > On 10/11/2016 07:15 AM, Andrew Palumbo wrote: >> Hi Karl, I was wondering if you'd had a chance to take a look at this? >> >> >> Any help would be much appreciated. We're looking to do a mahout >> release shortly and it would be great to have a ViennaCL vector >> implementation included. >> >> >> Thank you, >> >> >> Andy >> >> >> ------------------------ >> *From:* Andrew Palumbo <ap@outlook.com> >> *Sent:* Thursday, September 15, 2016 7:08:49 PM >> *To:* Karl Rupp; viennacl-devel@lists.sourceforge.net >> *Subject:* Re: [ViennaCL-devel] Fw: Matrix * Vector CL_OUT_OF_RESOURCES >> error >> >> >> >> Thank you I apologize for the sloppiness. >> >> >> with the correct compile line, I get: >> >> $ g++ DenseVectorMmul.cpp -I/usr/include/viennacl/ -lOpenCL -o denseVecs >> >> $ ./denseVecs >> terminate called after throwing an instance of 'viennacl::memory_exception' >> what(): ViennaCL: Internal memory error: not initialised! >> Aborted (core dumped) >> >> Thanks, >> >> Andy >> >> >> >> *From:* Karl Rupp <r...@iue.tuwien.ac.at> >> *Sent:* Thursday, September 15, 2016 6:46:40 PM >> *To:* Andrew Palumbo; viennacl-devel@lists.sourceforge.net >> *Subject:* Re: [ViennaCL-devel] Fw: Matrix * Vector CL_OUT_OF_RESOURCES >> error >> >> Hi, >> >> these are linker errors. Add -lOpenCL. >> If the OpenCL library is not available system-wide, also pass the the >> location with the -L flag. >> >> :-) >> >> Best regards, >> Karli >> >> >> On 09/16/2016 12:08 AM, Andrew Palumbo wrote: >>> >>> Apologies for accidentally not replying to the list last email >>> >>> >>> >>> >>> Thank you, Karl, I'd forgotten that because we have that Definition as >>> part of the java cpp setup. >>> >>> >>> With #define VIENNACL_WITH_OPENCL, though now I'm getting compile >>> errors. Are there possibly missing includes? I've checked this against >>> the blas2.cpp example, and don't see any missing. As well I cant seem >>> to find the suggested imports that you recommended several weeks back. >>> I've attached theu pdated .cpp file wi
Re: [ViennaCL-devel] Fw: Matrix * Vector CL_OUT_OF_RESOURCES error
Thank you, Karl. Wrt to (a) I'm using the 1.7.2 release from installed by apt-get on ununtu. So it's not the latest. I will try running with the code you provided tonight. The problem is that we use javacpp and so do not have access to stdlib as written currently. I will run the c++ code tonight and let you know. Thanks very much. Andy Sent from my Verizon Wireless 4G LTE smartphone Original message From: Karl Rupp <r...@iue.tuwien.ac.at> Date: 10/11/2016 7:31 AM (GMT-08:00) To: Andrew Palumbo <ap@outlook.com>, 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, 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 On 10/11/2016 07:15 AM, Andrew Palumbo wrote: > Hi Karl, I was wondering if you'd had a chance to take a look at this? > > > Any help would be much appreciated. We're looking to do a mahout > release shortly and it would be great to have a ViennaCL vector > implementation included. > > > Thank you, > > > Andy > > > > *From:* Andrew Palumbo <ap@outlook.com> > *Sent:* Thursday, September 15, 2016 7:08:49 PM > *To:* Karl Rupp; viennacl-devel@lists.sourceforge.net > *Subject:* Re: [ViennaCL-devel] Fw: Matrix * Vector CL_OUT_OF_RESOURCES > error > > > > Thank you I apologize for the sloppiness. > > > with the correct compile line, I get: > > $ g++ DenseVectorMmul.cpp -I/usr/include/viennacl/ -lOpenCL -o denseVecs > > $ ./denseVecs > terminate called after throwing an instance of 'viennacl::memory_exception' > what(): ViennaCL: Internal memory error: not initialised! > Aborted (core dumped) > > Thanks, > > Andy > > > > *From:* Karl Rupp <r...@iue.tuwien.ac.at> > *Sent:* Thursday, September 15, 2016 6:46:40 PM > *To:* Andrew Palumbo; viennacl-devel@lists.sourceforge.net > *Subject:* Re: [ViennaCL-devel] Fw: Matrix * Vector CL_OUT_OF_RESOURCES > error > > Hi, > > these are linker errors. Add -lOpenCL. > If the OpenCL library is not available system-wide, also pass the the > location with the -L flag. > > :-) > > Best regards, > Karli > > > On 09/16/2016 12:08 AM, Andrew Palumbo wrote: >> >> Apologies for accidentally not replying to the list last email >> >> >> >> >> Thank you, Karl, I'd forgotten that because we have that Definition as >> part of the java cpp setup. >> >> >> With #define VIENNACL_WITH_OPENCL, though now I'm getting compile >> errors. Are there possibly missing includes? I've checked this against >> the blas2.cpp example, and don't see any missing. As well I cant seem >> to find the suggested imports that you recommended several weeks back. >> I've attached theu pdated .cpp file with the correct #define as well as >> pasted it below the partial error dump. >> >> >> Thanks again for your time, >> >> Andy >> >> >> >> g++ DenseVectorMmul.cpp -I/usr/include/viennacl/ -o denseVec >> /tmp/ccSoGpk2.o: In function >> `viennacl::ocl::handle_inc_dec_helper<_cl_mem*>::dec(_cl_mem*&)': >> DenseVectorMmul.cpp:(.text._ZN8viennacl3ocl21handle_inc_dec_helperIP7_cl_memE3decERS3_[_ZN8viennacl3ocl21handle_inc_dec_helperIP7_cl_memE3decERS3_]+0x17): >> undefined reference to `clReleaseMemObject' >> /tmp/ccSoGpk2.o: In function >> `viennacl::ocl::handle_inc_dec_helper<_cl_program*>::dec(_cl_program*&)': >> DenseVectorMmul.cpp:(.text._ZN8viennacl3ocl21handle_inc_dec_helperIP11_cl_programE3decERS3_[_ZN8viennacl3ocl21handle_inc_dec_helperIP11_cl_programE3decERS3_]+0x17): >> undefined reference to `clReleaseProgram' >> /tmp/ccSoGpk2.o: In function >> `viennacl::ocl::handle_inc_dec_helper<_cl_kernel*>::dec(_
Re: [ViennaCL-devel] Fw: Matrix * Vector CL_OUT_OF_RESOURCES error
Hi, these are linker errors. Add -lOpenCL. If the OpenCL library is not available system-wide, also pass the the location with the -L flag. :-) Best regards, Karli On 09/16/2016 12:08 AM, Andrew Palumbo wrote: > > Apologies for accidentally not replying to the list last email > > > > > Thank you, Karl, I'd forgotten that because we have that Definition as > part of the java cpp setup. > > > With #define VIENNACL_WITH_OPENCL, though now I'm getting compile > errors. Are there possibly missing includes? I've checked this against > the blas2.cpp example, and don't see any missing. As well I cant seem > to find the suggested imports that you recommended several weeks back. > I've attached theu pdated .cpp file with the correct #define as well as > pasted it below the partial error dump. > > > Thanks again for your time, > > Andy > > > > g++ DenseVectorMmul.cpp -I/usr/include/viennacl/ -o denseVec > /tmp/ccSoGpk2.o: In function > `viennacl::ocl::handle_inc_dec_helper<_cl_mem*>::dec(_cl_mem*&)': > DenseVectorMmul.cpp:(.text._ZN8viennacl3ocl21handle_inc_dec_helperIP7_cl_memE3decERS3_[_ZN8viennacl3ocl21handle_inc_dec_helperIP7_cl_memE3decERS3_]+0x17): > undefined reference to `clReleaseMemObject' > /tmp/ccSoGpk2.o: In function > `viennacl::ocl::handle_inc_dec_helper<_cl_program*>::dec(_cl_program*&)': > DenseVectorMmul.cpp:(.text._ZN8viennacl3ocl21handle_inc_dec_helperIP11_cl_programE3decERS3_[_ZN8viennacl3ocl21handle_inc_dec_helperIP11_cl_programE3decERS3_]+0x17): > undefined reference to `clReleaseProgram' > /tmp/ccSoGpk2.o: In function > `viennacl::ocl::handle_inc_dec_helper<_cl_kernel*>::dec(_cl_kernel*&)': > DenseVectorMmul.cpp:(.text._ZN8viennacl3ocl21handle_inc_dec_helperIP10_cl_kernelE3decERS3_[_ZN8viennacl3ocl21handle_inc_dec_helperIP10_cl_kernelE3decERS3_]+0x17): > undefined reference to `clReleaseKernel' > /tmp/ccSoGpk2.o: In function > `viennacl::ocl::handle_inc_dec_helper<_cl_command_queue*>::inc(_cl_command_queue*&)': > DenseVectorMmul.cpp:(.text._ZN8viennacl3ocl21handle_inc_dec_helperIP17_cl_command_queueE3incERS3_[_ZN8viennacl3ocl21handle_inc_dec_helperIP17_cl_command_queueE3incERS3_]+0x17): > undefined reference to `clRetainCommandQueue' > /tmp/ccSoGpk2.o: In function > `viennacl::ocl::handle_inc_dec_helper<_cl_command_queue*>::dec(_cl_command_queue*&)': > DenseVectorMmul.cpp:(.text._ZN8viennacl3ocl21handle_inc_dec_helperIP17_cl_command_queueE3decERS3_[_ZN8viennacl3ocl21handle_inc_dec_helperIP17_cl_command_queueE3decERS3_]+0x17): > undefined reference to `clReleaseCommandQueue' > /tmp/ccSoGpk2.o: In function > `viennacl::ocl::handle_inc_dec_helper<_cl_context*>::inc(_cl_context*&)': > DenseVectorMmul.cpp:(.text._ZN8viennacl3ocl21handle_inc_dec_helperIP11_cl_contextE3incERS3_[_ZN8viennacl3ocl21handle_inc_dec_helperIP11_cl_contextE3incERS3_]+0x17): > undefined reference to `clRetainContext' > /tmp/ccSoGpk2.o: In function > `viennacl::ocl::handle_inc_dec_helper<_cl_context*>::dec(_cl_context*&)': > {snip.} > > > > DenseVectorMmul.cpp: > > > > #define VIENNACL_WITH_OPENCL > #include "viennacl/context.hpp" > #include "viennacl/matrix.hpp" > #include "viennacl/tools/random.hpp" > > > // C_vec = A_dense_matrix %*% B_vec. > > // compile line w/o OpenMP: g++ DenseVectorMmul.cpp > -I/usr/include/viennacl/ -o denseVec > > > > int main() > { > // trying to recreate javacpp wrapper functionalliy as closely as possible > // so not using typedef, unsigned ints, etc, and defining templates as > doubles > // creating buffers as int/double arrays and then setting pointers to > them. > // (not 100% sure that this is how javacpp passes pointers but should > be close.) > > > //typedef double ScalarType; > > // using unsigned ints here to suppress warnings/errors w/o using > -fpermissive` > // in acuallity, we cast `int`s from jni/javacpp. > unsigned int m = 200; > unsigned int n = 100; > > // create an OpenCL context which we will pass directly to the > constructors > // of the Matrix and vector > viennacl::context oclCtx(viennacl::OPENCL_MEMORY); > > double A_values[m * n] = {0}; > > viennacl::tools::uniform_random_numbers randomNumber; > for (int i = 0; i < m * n; i++) { > A_values[i] = randomNumber(); > } > > double* A_values_ptr = A_values; > > // this is currently the constructor that we're using through > scala/javacpp. > const viennacl::matrix>A_dense_matrix(A_values_ptr, oclCtx.memory_type() > , m, n); > > double B_values[n] = {0}; > > for (int i = 0; i < n; i++) { > B_values[i] = randomNumber(); > } > > double* B_values_ptr = B_values; > > // this is currently the constructor that we're using through > scala/javacpp. > viennacl::vector B_vec(B_values_ptr, oclCtx.memory_type(), n, > 0, 1); > > // perform multiplication and pass result to a vector constructor > viennacl::vector C_vec(viennacl::linalg::prod(A_dense_matrix , > B_vec)); > > // print out vec > std::cout