This project is read-only.

Cudafy on Amazon g2.2xlarge

Jan 21, 2014 at 3:17 PM
Does anybody have any experience using Amazon GPU servers with Cudafy? I am interested in looking into this as we need some additional CUDA servers for a small project but am wondering if anybody has any experience.

Jan 22, 2014 at 5:59 PM
Today I tried to get Cuda up and running on an Amazon G2 instance. After many hours I have not had any success getting Cuda installed, every time it fails to detect the graphics card. I have given up for today and will try again tomorrow....
Jan 23, 2014 at 9:25 AM
Never tried it but sounds interesting. Keep us updated.
As with all CUDAfy endeavors it is first essential that CUDA is working before getting CUDAfy running. Typically if GPU not detected it is because drivers not installed or you've connected via Remote Desktop which disables them. This should be accounted for with Amazon G2 I should think. I'd suggest contacting Amazon.
Jan 23, 2014 at 3:07 PM
Well I finally have CUDA installed after another day of messing around. I am now trying to get Cudafy up and running but am running into the same issues that I always seem to run into, mainly nvcc fatal : Cannot find compiler 'cl.exe' in PATH

I have VS Express 2010 C++ and C# installed and I have set the path as required but I still get this error message. Tomorrow is another day...
Jan 30, 2014 at 6:52 PM
Hi, any news on this front? I'm actually curious if you can run it on amazon's.
Feb 9, 2014 at 2:45 PM
Success, I can now build a CUDA ample app from C# and it runs....

Some notes for those looking to get this working on the AWS G2 machine...
  • The AMI I am using is Windows_Server-2012-RTM-English-64Bit-NVIDIA-2013.09.11-c5a0fda2-e5d2-44cc-afdf-9e5212dea05e-ami-97cd86fe.2 (ami-5a75942d)
  • You cannot remote desktop into the machine because that will disable the NVidia display driver. You need to remote desktop into the machine initially then install another viewer, I am using TeamViewer which can be used for free and only takes a minute to install.
  • You need to disable and uninstall the Microsoft Basic Display Adapter from the Device Manager in the Windows Control Panel.
  • I installed and registered the free versions of Visual Studio 2010 C++ and C#, these were installed in the default locations.
  • The NVIDIA driver I am using is the 320.59. The NVIDIA Control Panel works and shows the GPU as the GRID K520
  • Getting the CUDA toolkit 5.5 to install was extremely difficult and caused lots of problems so I gave up trying to install it.
  • Installing the CUDA Toolkit 5.0.35_winvista_win7_win8_general_64_3.msi completed ok.
  • Cudafy version installed is 1.26 in the default location.
Cudafy "Check for CUDA" button finds the GRID K520 device correctly.
Cudafy "Run CUDA Test" button throws the following error Compilation error: nvcc : fatal error : Visual Studio configuration file '(null)' could not be found for installation at 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin/../..'

I ignored this and tested the following code which works correctly!!!!!
class Program
        // class vars
        private static GPGPU gpu;

        static void Main(string[] args)
            // debug our environment
            if (Environment.Is64BitProcess)
                Console.WriteLine("Setting up GPU : Application is 64 bit");
                Console.WriteLine("Setting up GPU : Application is 32 bit");

            // translate the class and compile on the gpu
            CudafyTranslator.GenerateDebug = false;
            CudafyTranslator.DeleteTempFiles = true;

            // translate the class and compile on the gpu
            CudafyModule km = CudafyTranslator.Cudafy(eArchitecture.sm_30);

            // get the device and unload any existing modules on the device
            gpu = CudafyHost.GetDevice(eGPUType.Cuda);

            // load the module onto the device

            // get some device properties
            GPGPUProperties gpprop = gpu.GetDeviceProperties(false);
            Console.WriteLine("Device Cuda Name = " + gpprop.Name);
            Console.WriteLine("Device Cuda Capability = " + gpprop.Capability);
            Console.WriteLine("Device Clock Rate = " + gpprop.ClockRate);
            Console.WriteLine("Device Total Memory = " + gpprop.TotalMemory);

            // the setup is complete
            Console.WriteLine("Setting up GPU : Complete");

            // wait
Feb 9, 2014 at 3:29 PM
I have just converted my current app to run on the G2 instance. I had a problem trying to get the app to run as it is a 64bit app and VS Express is only 32bit, so I recreated a new project and copied the code in to get started quickly.

Before optimisation :

Testing performance, each GPU cycle on my current machine (GTX 560Ti OC) takes 440ms (the gpu is doing a lot), on the g2 instance it takes 230ms. It's not quite as good as it looks because the CPU is slower on the aws instance. My complete program loop takes 138 seconds on my machine, the same loop take 92 seconds on the g2 instance. I suspect I can get it faster with a bit more optimisation of grid and block sizes but this is the first test.

After initial optimisation :

I have tweaked the gpu grids and block size on the aws to get the best speed, the gpu loop now takes 192ms. The complete program loop is now 69 seconds vs 138 on my machine so I'm pretty happy with that. I am sure I can find a bit more.

The first weird thing I noticed is that Cudafy reports the gpu total memory and memory free incorrectly. Total memory is currently reported as 18446744073709551615!!!
Feb 10, 2014 at 9:23 AM
Very impressive work! Thanks for sharing this useful information.