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

Set GPU Index #7

Open
mgpai22 opened this issue Aug 27, 2024 · 1 comment
Open

Set GPU Index #7

mgpai22 opened this issue Aug 27, 2024 · 1 comment

Comments

@mgpai22
Copy link
Contributor

mgpai22 commented Aug 27, 2024

You can set as such

int main(int argc, char **argv) {

    cudaError_t cudaStatus = cudaSetDevice(GPU_INDEX);
    if (cudaStatus != cudaSuccess) {
        fprintf(stderr, "cudaSetDevice failed! Do you have a CUDA-capable GPU installed? Index: %d\n", GPU_INDEX);
        return 1;
    }
    ...
}
@mgpai22
Copy link
Contributor Author

mgpai22 commented Aug 27, 2024

Actually not certain if this works or not.

This worked for sure though

export CUDA_VISIBLE_DEVICES=<index of gpu>

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

1 participant