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

Compilation with compilation options not working #39

Open
vitalitylearning2021 opened this issue Oct 30, 2024 · 3 comments
Open

Compilation with compilation options not working #39

vitalitylearning2021 opened this issue Oct 30, 2024 · 3 comments

Comments

@vitalitylearning2021
Copy link

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 vitalitylearning2021 changed the title Compilation with compilation options now working Compilation with compilation options not working Nov 5, 2024
@cosminc98
Copy link
Collaborator

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

@cosminc98
Copy link
Collaborator

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
Copy link
Collaborator

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

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