nvcc4jupyter icon indicating copy to clipboard operation
nvcc4jupyter copied to clipboard

Compilation with compilation options not working

Open vitalitylearning2021 opened this issue 1 year ago • 3 comments

I'm trying to use nvcc4jupyter under Google Colab, using nvcc compilation options, but unsuccessfully.

If I use %%cuda -c "-l curand", the Colab's code box says:

usage: colab_kernel_launcher.py [-h] [-t] [-p] [-l PROFILER] [-a PROFILER_ARGS] [-c COMPILER_ARGS]

%%cuda magic that compiles and runs CUDA C++ code in this cell. See
https://nvcc4jupyter.readthedocs.io/en/latest/magics.html#cuda for usage details.

options:
  -h, --help            show this help message and exit
  -t, --timeit
  -p, --profile
  -l PROFILER, --profiler PROFILER
  -a PROFILER_ARGS, --profiler-args PROFILER_ARGS
  -c COMPILER_ARGS, --compiler-args COMPILER_ARGS
usage: colab_kernel_launcher.py [-h] [-t] [-p] [-l PROFILER] [-a PROFILER_ARGS] [-c COMPILER_ARGS]
colab_kernel_launcher.py: error: argument -c/--compiler-args: expected one argument

Normal compilation without options works correctly.

vitalitylearning2021 avatar Oct 30 '24 18:10 vitalitylearning2021

Hello! That indeed does not work and I'll try to figure out why as soon as I find some time.

cosminc98 avatar Dec 15 '24 11:12 cosminc98

Did not figure it out, but there's a workaround by adding an include path that does not exist. No idea why it works.

%%cuda -c "-I /does/not/exist -l curand"
#include <stdio.h>

int main()
{
    printf("It works!");
    return 0;
}

The following does not work:

%%cuda -c "-l curand"
#include <stdio.h>

int main()
{
    printf("It works!");
    return 0;
}

cosminc98 avatar Jan 25 '25 08:01 cosminc98

The "cuda" magic has a "-l" option so I think it's interpreting it as an option for it instead of passing it to nvcc

cosminc98 avatar Jan 25 '25 11:01 cosminc98