当前位置:首页 » 《资源分享》 » 正文

cuda切换脚本 与好用的AI云平台推荐 xl.hzxingzai.cn

22 人参与  2024年04月30日 14:16  分类 : 《资源分享》  评论

点击全文阅读


vim switch-cuda.sh

#!/usr/bin/env bash# Copyright (c) 2018 Patrick Hohenecker## Permission is hereby granted, free of charge, to any person obtaining a copy# of this software and associated documentation files (the "Software"), to deal# in the Software without restriction, including without limitation the rights# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell# copies of the Software, and to permit persons to whom the Software is# furnished to do so, subject to the following conditions:## The above copyright notice and this permission notice shall be included in all# copies or substantial portions of the Software.## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE# SOFTWARE.# author:   Patrick Hohenecker <mail@paho.at># version:  2018.1# date:     May 15, 2018set -e# ensure that the script has been sourced rather than just executedif [[ "${BASH_SOURCE[0]}" = "${0}" ]]; thenecho "Please use 'source' to execute switch-cuda.sh!"exit 1fiINSTALL_FOLDER="/usr/local"  # the location to look for CUDA installations atTARGET_VERSION=${1}          # the target CUDA version to switch to (if provided)# if no version to switch to has been provided, then just print all available CUDA installationsif [[ -z ${TARGET_VERSION} ]]; thenecho "The following CUDA installations have been found (in '${INSTALL_FOLDER}'):"ls -l "${INSTALL_FOLDER}" | egrep -o "cuda-[0-9]+\\.[0-9]+$" | while read -r line; doecho "* ${line}"doneset +ereturn# otherwise, check whether there is an installation of the requested CUDA versionelif [[ ! -d "${INSTALL_FOLDER}/cuda-${TARGET_VERSION}" ]]; thenecho "No installation of CUDA ${TARGET_VERSION} has been found!"set +ereturnfi# the path of the installation to usecuda_path="${INSTALL_FOLDER}/cuda-${TARGET_VERSION}"# filter out those CUDA entries from the PATH that are not needed anymorepath_elements=(${PATH//:/ })new_path="${cuda_path}/bin"for p in "${path_elements[@]}"; doif [[ ! ${p} =~ ^${INSTALL_FOLDER}/cuda ]]; thennew_path="${new_path}:${p}"fidone# filter out those CUDA entries from the LD_LIBRARY_PATH that are not needed anymoreld_path_elements=(${LD_LIBRARY_PATH//:/ })new_ld_path="${cuda_path}/lib64:${cuda_path}/extras/CUPTI/lib64"for p in "${ld_path_elements[@]}"; doif [[ ! ${p} =~ ^${INSTALL_FOLDER}/cuda ]]; thennew_ld_path="${new_ld_path}:${p}"fidone# update environment variablesexport CUDA_HOME="${cuda_path}"export CUDA_ROOT="${cuda_path}"export LD_LIBRARY_PATH="${new_ld_path}"#export PATH="${new_path}"export PATH="${PATH}:${new_path}"echo "Switched to CUDA ${TARGET_VERSION}."set +ereturn

使用方法

查看系统有几个cuda版本source switch-cuda.sh 切换cudasource switch-cuda.sh 9.0source switch-cuda.sh cuda版本

? 探索未来的计算力:星鸾云平台 ?
寻找一处归属你的GPU计算力殿堂?星鸾云平台热情欢迎您的到来!
作为一家致力于为用户提供高性能GPU显卡机器的领先平台,我们引以为傲的不仅仅是卓越的硬件产品,更是我们对服务品质的不懈追求。
? 平台支持多样化 ?
无论您是centos、debian还是ubuntu的忠实用户,星鸾云平台都能为您提供完美支持,确保您在使用我们产品时拥有无与伦比的便捷体验。
? 强大的显卡支持 ?
搭载着A800显卡的机器将为您带来超乎想象的计算性能,让您的任务如虎添翼。而更令人期待的是,我们即将推出的4090 L4显卡,将再次颠覆您对计算能力的认知!
? 优惠活动,登陆即享 ?
现在就登录星鸾云平台,即可获得价值200元的无门槛优惠券!立即行动,开启您GPU计算之旅的新篇章!
? 登录星鸾云平台xl.hzxingzai.cn,掌握未来计算的钥匙!?
无论您是科学研究、深度学习还是数据分析领域的从业者,星鸾云平台都将为您提供最专业、最可靠的计算支持。加入我们,让我们一同创造更加美好的未来!


点击全文阅读


本文链接:http://zhangshiyu.com/post/102398.html

<< 上一篇 下一篇 >>

  • 评论(0)
  • 赞助本站

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

关于我们 | 我要投稿 | 免责申明

Copyright © 2020-2022 ZhangShiYu.com Rights Reserved.豫ICP备2022013469号-1