Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Tao Chenyang <cytao@fu...>  20140524 12:41:24

Sorry, I found that the internal_size() returned is correct. But I do get an CL_INVALID_VALUE error message when I try to read internal_size() elements from GPU using viennacl::backend::memory_read 在 2014年5月24日，下午8:05，Tao Chenyang <cytao@...> 写道： > Dear Vienna maintainer, > I’m writing a matlab extension using viennacl and find that the internal_size() returned > is incorrect. > I’m running on Win 7 x64, using a AMD 7970 Graphic card. The viennaCL version I used > is 1.5.2. My MATLAB version is 2013b. I used VS 2012 to compile the mex file. > Enclosed is the MATLAB mex file along with the source code that generates the incorrect > internal_size. > Best, > Chenyang Tao > 2014.05.24 > > demo: > >>> matlab_viennacl(rand(10, 2)) > > Input Dimension: m=10 k=2 > ViennaCL DImension: m=10 k=2 > ViennaCL.InternalSize=16384, ActualInternalSize=20 > > <matlab_viennacl.zip> 
From: Tao Chenyang <cytao@fu...>  20140524 12:23:01
Attachments:
matlab_viennacl.zip

Dear Vienna maintainer, I’m writing a matlab extension using viennacl and find that the internal_size() returned is incorrect. I’m running on Win 7 x64, using a AMD 7970 Graphic card. The viennaCL version I used is 1.5.2. My MATLAB version is 2013b. I used VS 2012 to compile the mex file. Enclosed is the MATLAB mex file along with the source code that generates the incorrect internal_size. Best, Chenyang Tao 2014.05.24 demo: >> matlab_viennacl(rand(10, 2)) Input Dimension: m=10 k=2 ViennaCL DImension: m=10 k=2 ViennaCL.InternalSize=16384, ActualInternalSize=20 
From: Tao Chenyang <cytao@fu...>  20140524 12:41:24

Sorry, I found that the internal_size() returned is correct. But I do get an CL_INVALID_VALUE error message when I try to read internal_size() elements from GPU using viennacl::backend::memory_read 在 2014年5月24日，下午8:05，Tao Chenyang <cytao@...> 写道： > Dear Vienna maintainer, > I’m writing a matlab extension using viennacl and find that the internal_size() returned > is incorrect. > I’m running on Win 7 x64, using a AMD 7970 Graphic card. The viennaCL version I used > is 1.5.2. My MATLAB version is 2013b. I used VS 2012 to compile the mex file. > Enclosed is the MATLAB mex file along with the source code that generates the incorrect > internal_size. > Best, > Chenyang Tao > 2014.05.24 > > demo: > >>> matlab_viennacl(rand(10, 2)) > > Input Dimension: m=10 k=2 > ViennaCL DImension: m=10 k=2 > ViennaCL.InternalSize=16384, ActualInternalSize=20 > > <matlab_viennacl.zip> 
From: Karl Rupp <rupp@iu...>  20140524 16:17:53

Hi, as for the reason why internal_size() is much larger, have a look at this thread in the sourceforge forums: https://sourceforge.net/p/viennacl/discussion/1143678/thread/8158624c/?limit=25 As for the invalid read, I'm a bit puzzled. Maybe this has to do with some of the context and device switches in matlab_viennacl.txt? We use the same code for the implementation of viennacl::copy() and viennacl::fast_copy() (see around line 1200 in viennacl/matrix.hpp), so I assume that the error happens earlier. Could you provide a minimal example reproducing the issue? Best regards, Karli On 05/24/2014 02:41 PM, Tao Chenyang wrote: > Sorry, I found that the internal_size() returned is correct. > But I do get an CL_INVALID_VALUE error message when I try to read internal_size() elements > from GPU using viennacl::backend::memory_read > > 在 2014年5月24日，下午8:05，Tao Chenyang <cytao@...> 写道： > >> Dear Vienna maintainer, >> I’m writing a matlab extension using viennacl and find that the internal_size() returned >> is incorrect. >> I’m running on Win 7 x64, using a AMD 7970 Graphic card. The viennaCL version I used >> is 1.5.2. My MATLAB version is 2013b. I used VS 2012 to compile the mex file. >> Enclosed is the MATLAB mex file along with the source code that generates the incorrect >> internal_size. >> Best, >> Chenyang Tao >> 2014.05.24 >> >> demo: >> >>>> matlab_viennacl(rand(10, 2)) >> >> Input Dimension: m=10 k=2 >> ViennaCL DImension: m=10 k=2 >> ViennaCL.InternalSize=16384, ActualInternalSize=20 >> >> <matlab_viennacl.zip> > > > >  > "Accelerate Dev Cycles with Automated CrossBrowser Testing  For FREE > Instantly run your Selenium tests across 300+ browser/OS combos. > Get unparalleled scalability from the best Selenium testing platform available > Simple to use. Nothing to install. Get started now for free." > http://p.sf.net/sfu/SauceLabs > _______________________________________________ > ViennaCLsupport mailing list > ViennaCLsupport@... > https://lists.sourceforge.net/lists/listinfo/viennaclsupport > 
From: Tao Chenyang <cytao@fu...>  20140524 17:28:41
Attachments:
matlab_viennacl_error.zip
text/plain

Hi Karl, Thanks for your prompt reply. Please find the code and MATLAB mexw64 file for minimal replication of the error at the end of this mail. I found that the error occurs when you have initiated a data transfer from main RAM to the GPU device before memory_read. If I comment line 108110 in the example, then no error will occur. Hope you guys will find this useful. Best, Chenyang Tao 2014.05.25 demo : >> matlab_viennacl(rand(10, 5)); m=10 k=5 Tahiti internal_size = 16384 Unexpected Standard exception from MEX file. What() is:ViennaCL: FATAL ERROR: CL_INVALID_VALUE. If you think that this is a bug in ViennaCL, please report it at viennaclsupport@... and supply at least the following information: ….. 
From: Tao Chenyang <cytao@fu...>  20140524 17:32:39

P.S. While preparing for the ‘minimal example’ I accidentally deleted the line viennacl::backend::finish(); after calling for data transfer. But the error will still occur even with this line. 在 2014年5月25日，上午1:10，Tao Chenyang <cytao@...> 写道： > Hi Karl, > Thanks for your prompt reply. > Please find the code and MATLAB mexw64 file for minimal replication of > the error at the end of this mail. > I found that the error occurs when you have initiated a data transfer from > main RAM to the GPU device before memory_read. If I comment line 108110 > in the example, then no error will occur. > Hope you guys will find this useful. > Best, > Chenyang Tao > 2014.05.25 > > demo : > >>> matlab_viennacl(rand(10, 5)); > m=10 k=5 > Tahiti > internal_size = 16384 > Unexpected Standard exception from MEX file. > What() is:ViennaCL: FATAL ERROR: CL_INVALID_VALUE. > If you think that this is a bug in ViennaCL, please report it at > viennaclsupport@... and supply at least the following > information: > ….. > > <matlab_viennacl_error.zip> > 在 2014年5月25日，上午12:17，Karl Rupp <rupp@...> 写道： > >> Hi, >> >> as for the reason why internal_size() is much larger, have a look at this thread in the sourceforge forums: >> https://sourceforge.net/p/viennacl/discussion/1143678/thread/8158624c/?limit=25 >> >> As for the invalid read, I'm a bit puzzled. Maybe this has to do with some of the context and device switches in matlab_viennacl.txt? We use the same code for the implementation of viennacl::copy() and viennacl::fast_copy() (see around line 1200 in viennacl/matrix.hpp), >> so I assume that the error happens earlier. Could you provide a minimal example reproducing the issue? >> >> Best regards, >> Karli >> >> >> >> On 05/24/2014 02:41 PM, Tao Chenyang wrote: >>> Sorry, I found that the internal_size() returned is correct. >>> But I do get an CL_INVALID_VALUE error message when I try to read internal_size() elements >>> from GPU using viennacl::backend::memory_read >>> >>> 在 2014年5月24日，下午8:05，Tao Chenyang <cytao@...> 写道： >>> >>>> Dear Vienna maintainer, >>>> I’m writing a matlab extension using viennacl and find that the internal_size() returned >>>> is incorrect. >>>> I’m running on Win 7 x64, using a AMD 7970 Graphic card. The viennaCL version I used >>>> is 1.5.2. My MATLAB version is 2013b. I used VS 2012 to compile the mex file. >>>> Enclosed is the MATLAB mex file along with the source code that generates the incorrect >>>> internal_size. >>>> Best, >>>> Chenyang Tao >>>> 2014.05.24 >>>> >>>> demo: >>>> >>>>>> matlab_viennacl(rand(10, 2)) >>>> >>>> Input Dimension: m=10 k=2 >>>> ViennaCL DImension: m=10 k=2 >>>> ViennaCL.InternalSize=16384, ActualInternalSize=20 >>>> >>>> <matlab_viennacl.zip> >>> >>> >>> >>>  >>> "Accelerate Dev Cycles with Automated CrossBrowser Testing  For FREE >>> Instantly run your Selenium tests across 300+ browser/OS combos. >>> Get unparalleled scalability from the best Selenium testing platform available >>> Simple to use. Nothing to install. Get started now for free." >>> http://p.sf.net/sfu/SauceLabs >>> _______________________________________________ >>> ViennaCLsupport mailing list >>> ViennaCLsupport@... >>> https://lists.sourceforge.net/lists/listinfo/viennaclsupport >>> >> > 
From: Karl Rupp <rupp@iu...>  20140524 21:51:05

Hi, hmm, I don't see anything suspicious at first sight. I'll try to reproduce it tomorrow as a standalone program, I don't have a MATLAB installation at hand right now (I don't think this issue is specific to the MEX interface). Best regards, Karli On 05/24/2014 07:14 PM, Tao Chenyang wrote: > P.S. > While preparing for the ‘minimal example’ I accidentally deleted the line > viennacl::backend::finish(); > after calling for data transfer. But the error will still occur even with this line. > > 在 2014年5月25日，上午1:10，Tao Chenyang <cytao@...> 写道： > >> Hi Karl, >> Thanks for your prompt reply. >> Please find the code and MATLAB mexw64 file for minimal replication of >> the error at the end of this mail. >> I found that the error occurs when you have initiated a data transfer from >> main RAM to the GPU device before memory_read. If I comment line 108110 >> in the example, then no error will occur. >> Hope you guys will find this useful. >> Best, >> Chenyang Tao >> 2014.05.25 >> >> demo : >> >>>> matlab_viennacl(rand(10, 5)); >> m=10 k=5 >> Tahiti >> internal_size = 16384 >> Unexpected Standard exception from MEX file. >> What() is:ViennaCL: FATAL ERROR: CL_INVALID_VALUE. >> If you think that this is a bug in ViennaCL, please report it at >> viennaclsupport@... and supply at least the following >> information: >> ….. >> >> <matlab_viennacl_error.zip> >> 在 2014年5月25日，上午12:17，Karl Rupp <rupp@...> 写道： >> >>> Hi, >>> >>> as for the reason why internal_size() is much larger, have a look at this thread in the sourceforge forums: >>> https://sourceforge.net/p/viennacl/discussion/1143678/thread/8158624c/?limit=25 >>> >>> As for the invalid read, I'm a bit puzzled. Maybe this has to do with some of the context and device switches in matlab_viennacl.txt? We use the same code for the implementation of viennacl::copy() and viennacl::fast_copy() (see around line 1200 in viennacl/matrix.hpp), >>> so I assume that the error happens earlier. Could you provide a minimal example reproducing the issue? >>> >>> Best regards, >>> Karli >>> >>> >>> >>> On 05/24/2014 02:41 PM, Tao Chenyang wrote: >>>> Sorry, I found that the internal_size() returned is correct. >>>> But I do get an CL_INVALID_VALUE error message when I try to read internal_size() elements >>>> from GPU using viennacl::backend::memory_read >>>> >>>> 在 2014年5月24日，下午8:05，Tao Chenyang <cytao@...> 写道： >>>> >>>>> Dear Vienna maintainer, >>>>> I’m writing a matlab extension using viennacl and find that the internal_size() returned >>>>> is incorrect. >>>>> I’m running on Win 7 x64, using a AMD 7970 Graphic card. The viennaCL version I used >>>>> is 1.5.2. My MATLAB version is 2013b. I used VS 2012 to compile the mex file. >>>>> Enclosed is the MATLAB mex file along with the source code that generates the incorrect >>>>> internal_size. >>>>> Best, >>>>> Chenyang Tao >>>>> 2014.05.24 >>>>> >>>>> demo: >>>>> >>>>>>> matlab_viennacl(rand(10, 2)) >>>>> >>>>> Input Dimension: m=10 k=2 >>>>> ViennaCL DImension: m=10 k=2 >>>>> ViennaCL.InternalSize=16384, ActualInternalSize=20 >>>>> >>>>> <matlab_viennacl.zip> >>>> >>>> >>>> >>>>  >>>> "Accelerate Dev Cycles with Automated CrossBrowser Testing  For FREE >>>> Instantly run your Selenium tests across 300+ browser/OS combos. >>>> Get unparalleled scalability from the best Selenium testing platform available >>>> Simple to use. Nothing to install. Get started now for free." >>>> http://p.sf.net/sfu/SauceLabs >>>> _______________________________________________ >>>> ViennaCLsupport mailing list >>>> ViennaCLsupport@... >>>> https://lists.sourceforge.net/lists/listinfo/viennaclsupport >>>> >>> >> > > 
From: Karl Rupp <rupp@iu...>  20140525 20:03:00

Hi again, okay, the error has to do with fast_copy(): When you call viennacl::fast_copy(&(AA[0]), &(AA[0])+AA.size(), vcl_A); then the internal buffer of vcl_A is (erroneously) reallocated to a size of 'AA.size()', which may be smaller than internal_size(). To fix this, either make sure m and k are multiples of 128, or allocate 'AA' with the padding in mind, e.g. std::vector<ScalarType> AA(A.internal_size()); // set up data manually: for (i=0; i<m; ++i) for(j=0; j<k; ++j) AA[i*A.internal_size2() + j] = A[i*k + j]; (MATLAB uses a columnmajor data layout, while this code is for rowmajor layouts. You might have to change the array access and use viennacl::matrix<T, viennacl::column_major> for the matrix type) I created an issue at GitHub to make sure this behavior is improved in the 1.6.0 release: https://github.com/viennacl/viennacldev/issues/77 Best regards, Karli On 05/24/2014 07:14 PM, Tao Chenyang wrote: > P.S. > While preparing for the ‘minimal example’ I accidentally deleted the line > viennacl::backend::finish(); > after calling for data transfer. But the error will still occur even with this line. > > 在 2014年5月25日，上午1:10，Tao Chenyang <cytao@...> 写道： > >> Hi Karl, >> Thanks for your prompt reply. >> Please find the code and MATLAB mexw64 file for minimal replication of >> the error at the end of this mail. >> I found that the error occurs when you have initiated a data transfer from >> main RAM to the GPU device before memory_read. If I comment line 108110 >> in the example, then no error will occur. >> Hope you guys will find this useful. >> Best, >> Chenyang Tao >> 2014.05.25 >> >> demo : >> >>>> matlab_viennacl(rand(10, 5)); >> m=10 k=5 >> Tahiti >> internal_size = 16384 >> Unexpected Standard exception from MEX file. >> What() is:ViennaCL: FATAL ERROR: CL_INVALID_VALUE. >> If you think that this is a bug in ViennaCL, please report it at >> viennaclsupport@... and supply at least the following >> information: >> ….. >> >> <matlab_viennacl_error.zip> >> 在 2014年5月25日，上午12:17，Karl Rupp <rupp@...> 写道： >> >>> Hi, >>> >>> as for the reason why internal_size() is much larger, have a look at this thread in the sourceforge forums: >>> https://sourceforge.net/p/viennacl/discussion/1143678/thread/8158624c/?limit=25 >>> >>> As for the invalid read, I'm a bit puzzled. Maybe this has to do with some of the context and device switches in matlab_viennacl.txt? We use the same code for the implementation of viennacl::copy() and viennacl::fast_copy() (see around line 1200 in viennacl/matrix.hpp), >>> so I assume that the error happens earlier. Could you provide a minimal example reproducing the issue? >>> >>> Best regards, >>> Karli >>> >>> >>> >>> On 05/24/2014 02:41 PM, Tao Chenyang wrote: >>>> Sorry, I found that the internal_size() returned is correct. >>>> But I do get an CL_INVALID_VALUE error message when I try to read internal_size() elements >>>> from GPU using viennacl::backend::memory_read >>>> >>>> 在 2014年5月24日，下午8:05，Tao Chenyang <cytao@...> 写道： >>>> >>>>> Dear Vienna maintainer, >>>>> I’m writing a matlab extension using viennacl and find that the internal_size() returned >>>>> is incorrect. >>>>> I’m running on Win 7 x64, using a AMD 7970 Graphic card. The viennaCL version I used >>>>> is 1.5.2. My MATLAB version is 2013b. I used VS 2012 to compile the mex file. >>>>> Enclosed is the MATLAB mex file along with the source code that generates the incorrect >>>>> internal_size. >>>>> Best, >>>>> Chenyang Tao >>>>> 2014.05.24 >>>>> >>>>> demo: >>>>> >>>>>>> matlab_viennacl(rand(10, 2)) >>>>> >>>>> Input Dimension: m=10 k=2 >>>>> ViennaCL DImension: m=10 k=2 >>>>> ViennaCL.InternalSize=16384, ActualInternalSize=20 >>>>> >>>>> <matlab_viennacl.zip> >>>> >>>> >>>> >>>>  >>>> "Accelerate Dev Cycles with Automated CrossBrowser Testing  For FREE >>>> Instantly run your Selenium tests across 300+ browser/OS combos. >>>> Get unparalleled scalability from the best Selenium testing platform available >>>> Simple to use. Nothing to install. Get started now for free." >>>> http://p.sf.net/sfu/SauceLabs >>>> _______________________________________________ >>>> ViennaCLsupport mailing list >>>> ViennaCLsupport@... >>>> https://lists.sourceforge.net/lists/listinfo/viennaclsupport >>>> >>> >> > > 
From: Tao Chenyang <cytao@fu...>  20140526 00:33:38

Hi Karl, Thanks for your effort! I’ve noticed that padding will resolve the issue and that’s what I did in my code for the moment. Thanks for your tips on row major and column major issue, I’ve been manually transforming the matrix up to now. Looking forward to see your 1.6.0 release. Best, Chenyang Tao 2014.05.26 在 2014年5月26日，上午4:02，Karl Rupp <rupp@...> 写道： > Hi again, > > okay, the error has to do with fast_copy(): When you call > viennacl::fast_copy(&(AA[0]), &(AA[0])+AA.size(), vcl_A); > then the internal buffer of vcl_A is (erroneously) reallocated to a size of 'AA.size()', which may be smaller than internal_size(). To fix this, either make sure m and k are multiples of 128, or allocate 'AA' with the padding in mind, e.g. > > std::vector<ScalarType> AA(A.internal_size()); > > // set up data manually: > for (i=0; i<m; ++i) > for(j=0; j<k; ++j) > AA[i*A.internal_size2() + j] = A[i*k + j]; > > (MATLAB uses a columnmajor data layout, while this code is for rowmajor layouts. You might have to change the array access and use viennacl::matrix<T, viennacl::column_major> for the matrix type) > > I created an issue at GitHub to make sure this behavior is improved in the 1.6.0 release: > https://github.com/viennacl/viennacldev/issues/77 > > Best regards, > Karli > > > > On 05/24/2014 07:14 PM, Tao Chenyang wrote: >> P.S. >> While preparing for the ‘minimal example’ I accidentally deleted the line >> viennacl::backend::finish(); >> after calling for data transfer. But the error will still occur even with this line. >> >> 在 2014年5月25日，上午1:10，Tao Chenyang <cytao@...> 写道： >> >>> Hi Karl, >>> Thanks for your prompt reply. >>> Please find the code and MATLAB mexw64 file for minimal replication of >>> the error at the end of this mail. >>> I found that the error occurs when you have initiated a data transfer from >>> main RAM to the GPU device before memory_read. If I comment line 108110 >>> in the example, then no error will occur. >>> Hope you guys will find this useful. >>> Best, >>> Chenyang Tao >>> 2014.05.25 >>> >>> demo : >>> >>>>> matlab_viennacl(rand(10, 5)); >>> m=10 k=5 >>> Tahiti >>> internal_size = 16384 >>> Unexpected Standard exception from MEX file. >>> What() is:ViennaCL: FATAL ERROR: CL_INVALID_VALUE. >>> If you think that this is a bug in ViennaCL, please report it at >>> viennaclsupport@... and supply at least the following >>> information: >>> ….. >>> >>> <matlab_viennacl_error.zip> >>> 在 2014年5月25日，上午12:17，Karl Rupp <rupp@...> 写道： >>> >>>> Hi, >>>> >>>> as for the reason why internal_size() is much larger, have a look at this thread in the sourceforge forums: >>>> https://sourceforge.net/p/viennacl/discussion/1143678/thread/8158624c/?limit=25 >>>> >>>> As for the invalid read, I'm a bit puzzled. Maybe this has to do with some of the context and device switches in matlab_viennacl.txt? We use the same code for the implementation of viennacl::copy() and viennacl::fast_copy() (see around line 1200 in viennacl/matrix.hpp), >>>> so I assume that the error happens earlier. Could you provide a minimal example reproducing the issue? >>>> >>>> Best regards, >>>> Karli >>>> >>>> >>>> >>>> On 05/24/2014 02:41 PM, Tao Chenyang wrote: >>>>> Sorry, I found that the internal_size() returned is correct. >>>>> But I do get an CL_INVALID_VALUE error message when I try to read internal_size() elements >>>>> from GPU using viennacl::backend::memory_read >>>>> >>>>> 在 2014年5月24日，下午8:05，Tao Chenyang <cytao@...> 写道： >>>>> >>>>>> Dear Vienna maintainer, >>>>>> I’m writing a matlab extension using viennacl and find that the internal_size() returned >>>>>> is incorrect. >>>>>> I’m running on Win 7 x64, using a AMD 7970 Graphic card. The viennaCL version I used >>>>>> is 1.5.2. My MATLAB version is 2013b. I used VS 2012 to compile the mex file. >>>>>> Enclosed is the MATLAB mex file along with the source code that generates the incorrect >>>>>> internal_size. >>>>>> Best, >>>>>> Chenyang Tao >>>>>> 2014.05.24 >>>>>> >>>>>> demo: >>>>>> >>>>>>>> matlab_viennacl(rand(10, 2)) >>>>>> >>>>>> Input Dimension: m=10 k=2 >>>>>> ViennaCL DImension: m=10 k=2 >>>>>> ViennaCL.InternalSize=16384, ActualInternalSize=20 >>>>>> >>>>>> <matlab_viennacl.zip> >>>>> >>>>> >>>>> >>>>>  >>>>> "Accelerate Dev Cycles with Automated CrossBrowser Testing  For FREE >>>>> Instantly run your Selenium tests across 300+ browser/OS combos. >>>>> Get unparalleled scalability from the best Selenium testing platform available >>>>> Simple to use. Nothing to install. Get started now for free." >>>>> http://p.sf.net/sfu/SauceLabs >>>>> _______________________________________________ >>>>> ViennaCLsupport mailing list >>>>> ViennaCLsupport@... >>>>> https://lists.sourceforge.net/lists/listinfo/viennaclsupport >>>>> >>>> >>> >> >> > 