跨境派

跨境派

跨境派,专注跨境行业新闻资讯、跨境电商知识分享!

当前位置:首页 > 卖家故事 > cuda切换脚本 与好用的AI云平台推荐 xl.hzxingzai.cn

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

时间:2024-04-28 19:10:22 来源:网络cs 作者:言安琪 栏目:卖家故事 阅读:

标签: 平台  推荐  脚本 
阅读本书更多章节>>>>

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,掌握未来计算的钥匙!👈
无论您是科学研究、深度学习还是数据分析领域的从业者,星鸾云平台都将为您提供最专业、最可靠的计算支持。加入我们,让我们一同创造更加美好的未来!

阅读本书更多章节>>>>

本文链接:https://www.kjpai.cn/gushi/2024-04-28/163326.html,文章来源:网络cs,作者:言安琪,版权归作者所有,如需转载请注明来源和作者,否则将追究法律责任!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。

文章评论