from where to countthe number of NVIDIA controllers?

The file CUDA_Release_Notes_2.1_linux.txt

contains the text:

An example script (to be run at boot time):

#!/bin/bash

modprobe nvidia

if [ “$?” -eq 0 ]; then

Count the number of NVIDIA controllers found.

N3D=/sbin/lspci | grep -i NVIDIA | grep "3D controller" | wc -l
NVGA=/sbin/lspci | grep -i NVIDIA | grep "VGA compatible controller" | wc -l

N=expr $N3D + $NVGA - 1
for i in seq 0 $N; do
mknod -m 666 /dev/nvidia$i c 195 $i;
done

mknod -m 666 /dev/nvidiactl c 195 255

else
exit 1
fi

Question: in which file to include the above text and how to have it run each time to boot?

Thank you!

This is only needed when not running X.
If you need this, check your distribution on how to call scripts when initializing or changing a runlevel. In Fedora it will probably be runlevel 3 you need.