![]() | ![]() |
|
Welcome to the HEXUS.community discussion forums forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and other features. By joining our free community you will have access to post topics, respond to polls and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! |
| |||||||
| Software and web development Databases, graphics, programming, scripting and web development. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Sonic Boom! Join Date: Aug 2005 Location: Cornwall / Durham University
Posts: 1,404
Thanks: 13
Thanked 10 Times in 9 Posts
| CUDA 2D Array Problems Hi all, I've posted this over at the Nvidia forums as well but thought I'd try my luck here too ![]() Original Post: I've just started to learn CUDA and have created a simple program that creates a 2D array of int, assigns the memory on the device and then copies the array onto the device. Eventually I want to expand this into a graph searching algorithm. However, when using an array with 1,000 verticies (indicies) it simply crashes. As far as I can tell, its populating the array on the host that causes the crash. Call me a noob but I thought that an array of this size was perfectly acceptable? Here's my code anyway #include <stdio.h> #include <cuda.h> __global__ void myKernel(int* deviceArrayPtr, int pitch) { } main() { int* deviceArrayPtr; size_t devicePitch, hostPitch, width, height; int hostArray[1000][1000]; width = 1000; height = 1000; for(int i = 0; i < 1000; i ++) for(int j = 0; j < 1000; j ++) hostArray[i][j] = 20; //20 is an abitrary number //Allocates memory on the device cudaMallocPitch((void**)&deviceArrayPtr, &devicePitch, width * sizeof(int), height); hostPitch = devicePitch; //Copies hostArray onto the pre-allocated device memory cudaMemcpy2D(deviceArrayPtr, devicePitch, &hostArray, hostPitch, width * sizeof(int), height, cudaMemcpyHostToDevice); myKernel <<< 100, 512 >>> (deviceArrayPtr, devicePitch); } Anyone have any ideas about this? |
| | |
| | #2 (permalink) |
| Gentoo Ricer Join Date: Jan 2005 Location: /var/portage
Posts: 5,727
Thanks: 66
Thanked 266 Times in 247 Posts
| Re: CUDA 2D Array Problems The array fill loop code is fine. It's likely your cuda calls which are the problem. Originally Posted by Agent
Server Box -> Asus P5B-E Plus | C2D E6320 | 2x2GB GieL PC2-6400 | 6x500GB (md-raid5) | nVidia 7300LE | Ubuntu Server 9.10 (for now) Test Box -> P4E 3.2Ghz Rev. E0 | Asus P4C800-E Deluxe | 2x1GB PC3200 | 2x160Gb | nVidia TNT 2 | Gentoo (X86) Currently breaking: eINIT Last edited by aidanjt; 19-10-2009 at 03:56 PM.. |
| | |
![]() |
| Breadcrumb | ||||||
| ||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problems with Abit Netherlands Tech Support. | CJShielder | abit.care@HEXUS ![]() | 4 | 18-04-2008 08:24 AM |
| need a new raid array so I've done some math for the best space/cost disk to use. | atrull | HEXUS.hardware | 15 | 31-07-2006 05:13 PM |
| Cloning a Raid0 to a Raid5 array | Stephen B | Operating systems & applications | 5 | 29-06-2005 08:35 AM |
| Troubleshooting - Software & Driver problems | Steve | Help - technical & advisory | 0 | 09-07-2004 05:30 PM |
| more VBA and SQL 'problems'... | streetster | Software and web development | 7 | 07-01-2004 09:45 PM |