• HEXUS
  • HEXUS.tv
  • channel
  • gaming
  • lifestyle
  • trust
  • community
  • ESReality
  • HEXUS.community discussion forumsVisit Corsair.com

    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!

    Go Back   HEXUS.community discussion forums > HEXUS.help - buying advice & technical queries > Operating systems & applications > Software and web development

    Software and web development Databases, graphics, programming, scripting and web development.

    Reply
     
    LinkBack Thread Tools
    Old 15-10-2009, 04:56 PM   #1 (permalink)
    Odc
    Sonic Boom!
     
    Odc's Avatar
     
    Join Date: Aug 2005
    Location: Cornwall / Durham University
    Posts: 1,404
    Thanks: 13
    Thanked 10 Times in 9 Posts
    Odc's system
    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?


    Hexus Trust = Odesi
    Sonisphere FMC Code = 1k928478
    Odc is offline   Reply With Quote
    Old 19-10-2009, 03:50 PM   #2 (permalink)
    Gentoo Ricer
     
    Join Date: Jan 2005
    Location: /var/portage
    Posts: 5,727
    Thanks: 66
    Thanked 266 Times in 247 Posts
    aidanjt's system
    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 View Post
    ...every time Creative bring out a new card range their advertising makes it sound like they have discovered a way to insert a thousand Chuck Norris super dwarfs in your ears...
    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..
    aidanjt is offline   Reply With Quote
    Reply

    Breadcrumb
    Go Back   HEXUS.community discussion forums > HEXUS.help - buying advice & technical queries > Operating systems & applications > Software and web development


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Trackbacks are On
    Pingbacks are On
    Refbacks are On


    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



    All times are GMT. The time now is 07:43 PM.

    Any representations/statements made on the HEXUS.community discussion forums are the representations/statements of the author i.e. the person/organisation making them. If any such representations/statements are disputed they are a matter between the parties concerned.
    HEXUS Limited accepts no responsibility for any misrepresentations, inaccurate or false statements made by any person/organisation other than HEXUS Limited employees.
    For more information please read HEXUS Limited's terms, conditions and privacy policy.

    Hosted Exchange

    Powered by vBulletin® Version 3.8.4
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Content Relevant URLs by vBSEO 3.3.2
    © Copyright 2009 HEXUS® Limited. All rights reserved. Unauthorised reproduction strictly prohibited.