Hi Maciej,

The memory management is still something that I am trying to improve.  If
you use a GPU monitoring program you can watch the GPU usage fill up.  You
are likely seeing crashes on 100, 1000 after the crash on 2000 because
previous data is likely still on the GPU.  If you call 'gc()' that should
clear up the GPU and you can run your smaller matrices again.

You need to keep in mind a few things here.

1. Your GPU isn't very large (~2GB from my calculations)
2. You are on Windows which usually is leveraging whatever card you have
installed
3. You are using 'double' precision by default
4. Matrices are padded as well for performance reasons (so they are larger
than they appear)
5. The RAM cleanup is only completed when R calls garbage collection or you
do it manually (i.e. gc())

I believe this should help you for now.  I assume you are using the current
CRAN version of gpuR.  I have been working a lot on the next version where
I am leveraging smart pointers in C++ to hopefully help manage the memory
persistence better.  You can always try it out from my github with
`devtools::install_github('cdeterman/gpuR', ref = 'develop')`

Hope this helps,
Charles


On Tue, Jun 27, 2017 at 2:40 AM, Karl Rupp <[email protected]> wrote:

> Hi Maciej,
>
> does the problem also show up for smaller values of k? 2000 should be
> alright, but I've already seen cases where a video in the background caused
> such kind of problems (because GPU-RAM was almost exhausted).
>
> I also CC: Chales Determan, who is the author of gpuR.
>
> Best regards,
> Karli
>
>
> On 06/27/2017 09:28 AM, Maciej Janiec wrote:
>
>> I was able to use the gpuR package just once. After the first time, it is
>> crashing every time.
>>
>> System: Windows 10
>> GPU: GeForce GT 730
>>
>>   gpuMatrix is created, but the code crashed at gpuA %*% gpuA.
>>
>> This works:
>>
>>  > k <- 2000
>>  >
>>  > system.time( {
>> +
>> + gpuA <- gpuMatrix(rnorm(k^2), nrow=k, ncol=k)
>> + # gpuB <- gpuA %*% gpuA
>> +
>> +  } )
>>     user  system elapsed
>>     0.39    0.05    0.44
>>
>>
>> This crashes:
>>
>>  > k <- 2000
>>  >
>>  > system.time( {
>> +
>> + gpuA <- gpuMatrix(rnorm(k^2), nrow=k, ncol=k)
>> + gpuB <- gpuA %*% gpuA
>> +
>> +  } )
>> ViennaCL: FATAL ERROR: Kernel start failed for 'assign_cpu'.
>> ViennaCL: Smaller work sizes could not solve the problem.
>>   Show Traceback
>>   Rerun with Debug
>>   Error in cpp_gpuMatrix_gemm(A@address, B@address, C@address, 8L) :
>>    ViennaCL: FATAL ERROR: CL_MEM_OBJECT_ALLOCATION_FAILURE
>>   ViennaCL could not allocate memory on the device. Most likely the
>> device simply ran out of memory.
>> If you think that this is a bug in ViennaCL, please report it at
>> [email protected] <mailto:viennacl-support@lists
>> .sourceforge.net> and supply at least the following information:
>>   * Operating System
>>   * Which OpenCL implementation (AMD, NVIDIA, etc.)
>>   * ViennaCL version
>> Many thanks in advance! Timing stopped at: 0.42 0.07 0.5
>>
>> System stats:
>>
>>  > gpuInfo()
>> $deviceName
>> [1] "GeForce GT 730"
>>
>> $deviceVendor
>> [1] "NVIDIA Corporation"
>>
>> $numberOfCores
>> [1] 2
>>
>> $maxWorkGroupSize
>> [1] 1024
>>
>> $maxWorkItemDim
>> [1] 3
>>
>> $maxWorkItemSizes
>> [1] 1024 1024   64
>>
>> $deviceMemory
>> [1] 2147483648
>>
>> $clockFreq
>> [1] 1400
>>
>> $localMem
>> [1] 49152
>>
>> $maxAllocatableMem
>> [1] 536870912
>>
>> $available
>> [1] "yes"
>>
>> $deviceExtensions
>>   [1] "cl_khr_global_int32_base_atomics"     
>> "cl_khr_global_int32_extended_atomics"
>> "cl_khr_local_int32_base_atomics"
>>   [4] "cl_khr_local_int32_extended_atomics"  "cl_khr_fp64"
>>              "cl_khr_byte_addressable_store"
>>   [7] "cl_khr_icd"                           "cl_khr_gl_sharing"
>>            "cl_nv_compiler_options"
>> [10] "cl_nv_device_attribute_query"         "cl_nv_pragma_unroll"
>>            "cl_nv_d3d10_sharing"
>> [13] "cl_khr_d3d10_sharing"                 "cl_nv_d3d11_sharing"
>>            "cl_nv_copy_opts"
>>
>> $double_support
>> [1] TRUE
>>
>>  >
>>  > detectPlatforms()
>> [1] 1
>>  > detectGPUs()
>> [1] 1
>>
>> MJ
>>
>>
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>
>>
>>
>> _______________________________________________
>> ViennaCL-support mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/viennacl-support
>>
>>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
ViennaCL-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/viennacl-support

Reply via email to