Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cuda not showing output in Google collab #1

Closed
Bk8 opened this issue Mar 12, 2019 · 1 comment
Closed

Cuda not showing output in Google collab #1

Bk8 opened this issue Mar 12, 2019 · 1 comment

Comments

@Bk8
Copy link

Bk8 commented Mar 12, 2019

I'm using this code, to prepare the environment

!/usr/local/cuda/bin/nvcc --version
!gcc-5 -v
!pip install git+git://github.com/andreinechaev/nvcc4jupyter.git
%load_ext nvcc_plugin
!rm /usr/bin/gcc
!rm /usr/bin/g++
!ln -s /usr/bin/gcc-5 /usr/bin/gcc
!ln -s /usr/bin/g++-5 /usr/bin/g++

Then when I try to run this simple example:

%%cu
#include <stdio.h>

void helloCPU()
{
  printf("Hello from the CPU.\n");
}

/*
 * The addition of `__global__` signifies that this function
 * should be launced on the GPU.
 */

__global__ void helloGPU()
{
  printf("Hello from the GPU.\n");
}

int main()
{
   helloCPU();


  /*
   * Add an execution configuration with the <<<...>>> syntax
   * will launch this function as a kernel on the GPU.
   */

  helloGPU<<<1, 1>>>();

  /*
   * `cudaDeviceSynchronize` will block the CPU stream until
   * all GPU kernels have completed.
   */

  cudaDeviceSynchronize();
}

It runs but I get the output from the CPU but not the GPU

'Hello from the CPU.\n'

@Bk8
Copy link
Author

Bk8 commented Mar 12, 2019

Sorry I was running it without a GPU, now it's working!
Thanks for the great plugin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants