# !!!! device access error (write)

**URL:** <https://forums.developer.nvidia.com/t/device-access-error-write/34682>\
**Category:** CUDA Programming and Performance\
**Created:** [September 2, 2014, 7:41pm UTC](https://forums.developer.nvidia.com/t/device-access-error-write/34682 "2014-09-02T19:41:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![civilman](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@civilman](https://forums.developer.nvidia.com/u/civilman)\
**Post date:** [September 2, 2014, 7:41pm UTC](https://forums.developer.nvidia.com/t/device-access-error-write/34682/1 "2014-09-02T19:41:10Z")

</div>

when I run this code below, which call cudafree and meet error:

checkCudaErrors(cudaFree(\_devData));

====================================

!!! device access error (write)

I install cuda 6.5 with latest driver, my card is GTX 760 with 4GB mem.

---

<div class="post-metadata">

**Author:** ![civilman](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@civilman](https://forums.developer.nvidia.com/u/civilman)\
**Post date:** [September 2, 2014, 11:47pm UTC](https://forums.developer.nvidia.com/t/device-access-error-write/34682/2 "2014-09-02T23:47:10Z")

</div>

is this a hardware issue?

---

<div class="post-metadata">

**Author:** ![Robert\_Crovella](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/robert_crovella/32/14043_2.png) [@Robert\_Crovella](https://forums.developer.nvidia.com/u/Robert_Crovella)\
**Post date:** [September 3, 2014, 12:38am UTC](https://forums.developer.nvidia.com/t/device-access-error-write/34682/3 "2014-09-03T00:38:28Z")

</div>

There’s no way to know from what you have shown here. checkCudaErrors is not a standard part of the CUDA runtime API. It is a function call or a macro that is provided by your code. Furthermore, if it is simply reporting (printing) a CUDA runtime API error that is returned by cudaFree, it would be useful to know what the numerical code actually was, since it’s not obvious from the text.

Perhaps if you provide a complete code, that someone else could compile and run, you might get a more useful reply. It’s likely you will need to trap and display the actual numerical error being returned by cudaFree, in order to get any useful suggestions.

---

<div class="post-metadata">

**Author:** ![civilman](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@civilman](https://forums.developer.nvidia.com/u/civilman)\
**Post date:** [September 3, 2014, 7:24pm UTC](https://forums.developer.nvidia.com/t/device-access-error-write/34682/4 "2014-09-03T19:24:33Z")

</div>

code from here: [GitHub - s271/win\_convnet: Port of Alex Krizhevsky's cuda-convnet to windows x64 . Original project http://code.google.com/p/cuda-convnet/](https://github.com/s271/win_convnet)

the error happen below, “memory free error”. I try both cudaFree() and cublasFree(), they are the same.

The problem is, it is python code call CUDA DLL: Python.exe process load CUDA DLL modules. I try to use Nsight attach to process to debug, but it cannot, as main process is Python.exe but not that DLL.

What should I do to debug into CUDA DLL, which is called by python.exe?

NVMatrix::~NVMatrix() {  
if(\_ownsData && \_numElements \> 0) {  
cublasStatus status = cublasFree(\_devData);  
if (status != CUBLAS\_STATUS\_SUCCESS) {  
fprintf(stderr, “!!! memory free error\n”);  
exit(EXIT\_FAILURE);  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![Robert\_Crovella](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/robert_crovella/32/14043_2.png) [@Robert\_Crovella](https://forums.developer.nvidia.com/u/Robert_Crovella)\
**Post date:** [September 3, 2014, 8:01pm UTC](https://forums.developer.nvidia.com/t/device-access-error-write/34682/5 "2014-09-03T20:01:11Z")

</div>

for starters, print out the actual numerical value of the status variable

---

<div class="post-metadata">

**Author:** ![civilman](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@civilman](https://forums.developer.nvidia.com/u/civilman)\
**Post date:** [September 8, 2014, 4:43pm UTC](https://forums.developer.nvidia.com/t/device-access-error-write/34682/6 "2014-09-08T16:43:26Z")

</div>

I get status is 14

---

<div class="post-metadata">

**Author:** ![Robert\_Crovella](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/robert_crovella/32/14043_2.png) [@Robert\_Crovella](https://forums.developer.nvidia.com/u/Robert_Crovella)\
**Post date:** [September 8, 2014, 5:16pm UTC](https://forums.developer.nvidia.com/t/device-access-error-write/34682/7 "2014-09-08T17:16:00Z")

</div>

Your application appears to be using the CUBLAS legacy API, for which cublasFree is a thin wrapper around cudaFree. (the non-legacy API has no cublasFree function).  
Error 14 can be found in the CUDA documentation:

[url][CUDA Runtime API :: CUDA Toolkit Documentation](http://docs.nvidia.com/cuda/cuda-runtime-api/group __CUDART__ TYPES.html#group __CUDART__ TYPES%5B/url%5D)

as well as in driver\_types.h in the CUDA header files. It is:

cudaErrorMapBufferObjectFailed = 14 This indicates that the buffer object could not be mapped.

This is not one of the 3 possible return codes from cudaFree:

[url][CUDA Runtime API :: CUDA Toolkit Documentation](http://docs.nvidia.com/cuda/cuda-runtime-api/group __CUDART__ MEMORY.html#group __CUDART__ MEMORY_1g02b08ab28cfc28c37976556044fb5335%5B/url%5D)

Therefore I would assume, as described in the cudaFree documentation, that is an error code “left over” from some previous asynchronous activity. You should probably work backward in your code, making sure you have adequately done proper CUDA and CUBLAS error checking at each point. You might also want to run your code with cuda-memcheck, which may yield some clues.
