How to use _install_cudnn method in lisa

Best Python code snippet using lisa_python

gpusuite.py

Source:gpusuite.py Github

copy

Full Screen

...131 ),132 )133 def verify_gpu_cuda_with_pytorch(self, node: Node) -> None:134 _check_driver_installed(node)135 _install_cudnn(node)136 gpu = node.features[Gpu]137 pip = node.tools[Pip]138 if not pip.exists_package("torch"):139 pip.install_packages("torch")140 gpu_script = "import torch;print(f'gpu count: {torch.cuda.device_count()}')"141 python = node.tools[Python]142 expected_count = gpu.get_gpu_count_with_lspci()143 script_result = python.run(144 f'-c "{gpu_script}"',145 force_run=True,146 )147 gpu_count_str = get_matched_str(script_result.stdout, self._pytorch_pattern)148 script_result.assert_exit_code(149 message=f"failed on run gpu script: {gpu_script}, "150 f"output: {script_result.stdout}"151 )152 assert_that(gpu_count_str).described_as(153 f"gpu count is not in result: {script_result.stdout}"154 ).is_not_empty()155 gpu_count = int(gpu_count_str)156 assert_that(gpu_count).described_as(157 "GPU must be greater than zero."158 ).is_greater_than(0)159 assert_that(gpu_count).described_as(160 "cannot detect GPU from PyTorch"161 ).is_equal_to(expected_count)162def _check_driver_installed(node: Node) -> None:163 gpu = node.features[Gpu]164 if not gpu.is_supported():165 raise SkippedException(f"GPU is not supported with distro {node.os.name}")166 if ComputeSDK.AMD in gpu.get_supported_driver():167 raise SkippedException("AMD vm sizes is not supported")168 try:169 _ = node.tools[NvidiaSmi]170 except Exception as identifier:171 raise LisaException(172 f"Cannot find nvidia-smi, make sure the driver installed correctly. "173 f"Inner exception: {identifier}"174 )175def _install_cudnn(node: Node) -> None:176 wget = node.tools[Wget]177 tar = node.tools[Tar]178 path = wget.get_tool_path(use_global=True)179 extracted_path = tar.get_tool_path(use_global=True)180 if node.shell.exists(path / _cudnn_file_name):181 return182 download_path = wget.get(183 url=_cudnn_location, filename=str(_cudnn_file_name), file_path=str(path)184 )185 tar.extract(download_path, dest_dir=str(extracted_path))186 if isinstance(node.os, Debian):187 target_path = "/usr/lib/x86_64-linux-gnu/"188 else:189 target_path = "/usr/lib64/"...

Full Screen

Full Screen

fabfile.py

Source:fabfile.py Github

copy

Full Screen

...39 sudo('apt-get update -yq')40 sudo('apt-get install -yq cuda')41 run('echo "export PATH=/usr/local/cuda/bin:$PATH" >> ~/.bash_profile')42 fabric.operations.reboot()43def _install_cudnn(ver, cudnn):44 url = 'http://developer.download.nvidia.com/compute/redist/cudnn/%s/%s' % (ver, cudnn)45 run('wget -q %s' % url)46 sudo('tar -xzf %s -C /usr/local' % cudnn)47 run('rm %s' % cudnn)48 sudo('ldconfig')49def install_cudnn5():50 _install_cudnn('v5.1', 'cudnn-8.0-linux-x64-v5.1.tgz')51def install_cudnn4():52 _install_cudnn('v4', 'cudnn-7.0-linux-x64-v4.0-prod.tgz')53def install_cudnn3():54 _install_cudnn('v3', 'cudnn-7.0-linux-x64-v3.0-prod.tgz')55def install_cudnn2():56 _install_cudnn('v2', 'cudnn-6.5-linux-x64-v2.tgz')57def install_chainer_env():58 sudo('apt-get install -yq g++ libhdf5-dev python3-dev python3-pip')59 sudo('pip3 install -U setuptools pip')60 sudo('pip3 install h5py')61 sudo('pip3 install numpy')62def install_chainer():63 apt_update()64 install_nvidia()65 install_cuda80_deb()66 install_cudnn5()67 install_chainer_env()68 sudo('pip3 install chainer')69 # On ubuntu16.04, lightdb runs out of cpu.70 sudo('systemctl disable lightdm')...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful