How to install nvidia-smi?
43
nvidia-smi binary symlink created when you install the nvidia driver, as nvidia-340 in my case. Take a look:
darlene ➜ ls -la `which nvidia-smi`
lrwxrwxrwx 1 root root 34 Mai 24 20:52 /usr/bin/nvidia-smi -> /etc/alternatives/x86_64-linux-gnu_nvidia_smi
darlene ➜ ls -la /etc/alternatives/x86_64-linux-gnu_nvidia_smi
lrwxrwxrwx 1 root root 34 Mai 24 20:52 /etc/alternatives/x86_64-linux-gnu_nvidia_smi -> /usr/lib/nvidia-340/bin/nvidia-smi
And the final binary comes from:
darlene ➜ dpkg -S /usr/lib/nvidia-340/bin/nvidia-smi
nvidia-340: /usr/lib/nvidia-340/bin/nvidia-smi
Related videos on Youtube
Author by
Oriol
Updated on September 18, 2022Comments
-
Oriol over 1 year
I have been working on creating a C program that given a sequence of digits (provided as a char array), the program returns as many X as the number of digits the input contains (e.g. input: "1234"--> output:"XXXX")
The code I have written is:
#include <stdio.h> #include <string.h> #include <stdlib.h> const char* getPlaceholder(char * word); int main(){ char * myWords []={"111","22222","1113445","9"}; char ** mywords_pointer=myWords; /*We will apply the function getPlaceholder to each of the components of the myWords array */ for (int indx=0; indx<3; indx++){ char *currentWord=*(mywords_pointer+indx); const char *placeholder; printf("Calling function\n"); placeholder=getPlaceholder(currentWord); printf("The placeholder for %s is: %s\n",currentWord, placeholder); } return 0; } //getPlaceholder gets a number as a string and outputs as many Xs as digits the imput number has. const char* getPlaceholder(char * number){ char *ptr; long wordAsNumb=strtol(number,&ptr,10);/* in order to later be able to count the number of digits the input 'number' has*/ char *currentPlaceholder='\0';//this variable is initialised and later we will later be added new Xs in case the input number has more than one digit. "222"--> 222 '\0' .X \0' while (wordAsNumb>1){ size_t len=strlen(currentPlaceholder); //this is the variable which will contain the placeholder (Xs) corresponding to the input number char *output_string=malloc(len+2); /* adds two new characters to fit a new X (to increase the number of digits the input number has) and the "\0" */ strcpy(output_string,currentPlaceholder); output_string[len]='X'; output_string[len+1]='\0'; /* in order to copy the currentPlaceholder value to 'output_string'. Then we add the two nex characters in the array*/ printf("String output is now %s\n ",output_string); strcpy(currentPlaceholder,output_string); free (output_string); wordAsNumb/=10; } const char* finalPlaceholder=currentPlaceholder; return finalPlaceholder; }
However, I have stumbled upon the warning:
initialization makes pointer from integer without a cast [-Wint-conversion]
in line:
char *output_string='X';
Any thoughts on what is wrong exactly?
Many thanks
-
Mark Kirby over 8 yearsHow did you install the driver ? PPA ? nvidia website ? or did you build it ?
-
Shervin Gharib over 8 years@markkirby, I installed it like what nvidia site said. 'sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb' 'sudo apt-get update' 'sudo apt-get install cuda'
-
Mark Kirby over 8 yearsDid you not also install the driver ? You must install both CUDA and the driver as nvidia-smi is packaged with the driver.
-
Shervin Gharib over 8 years@markkirby no, I completely installed nvidia-352, Even I installed nvidia-340 but there is no nvidia-smi. My laptop has Intel 3000 and Nvidia 525M, is it important?
-
Mark Kirby over 8 yearsYes you have a hybrid GPU right ? Intel and Nvidia ? First remove everything you installed with
sudo apt-get purge nvidia*
Then see here for the driver instructions askubuntu.com/questions/452556/…, then reinstall cuda, please see here for bumblebee docs, bumblebee-project.org/install.html -
h0r53 almost 3 yearsIn short, when defining an inline C-string you need to double quote the initial value. Here you have single quoted it, so the compiler attempts to treat it as an
int
instead of a null-terminated char array. -
Clifford almost 3 yearsThe title "program with nesting warning in placeholder function" appears to have no connection to the actual question. What does that even mean?
-
Oriol almost 3 years@Clifford. You are completely right. I wrote nesting instead of casting. That has been fixed already
-
Clifford almost 3 years"placeholder function" suggests a temporary function that will later be replaced. That is not the sense you mean it here. Even with the typo fixed, it is misleading. I don't think the actual function name or what it is intended to do is particularly relevant in any case.
-
Oriol almost 3 yearsYou were all completely right in that the code was unclear and indeed with mistakes. I have added some comments that hopefully will make it clear. Hopefully now the idea of the code is clearer.
-
-
fmoo over 7 yearsIt's super weird, but I can't find this alternative, even after reinstalling multiples times. Maybe the nvidia driver install is silently aborting or failing halfway through?
-
Tomasz Gandor over 5 yearsWow, I've just learned something new -
dpkg -S
would not find symlinks (in case of alternatives). @fmoo - well, check all files withdpkg -L nvidia-390
(or whichever version you have), findnvidia-smi
binary, and call it with absolute path, or add this location to your$PATH
variable.