当前位置: 首页 > news >正文

搭建MPI/CUDA开发环境

本文记录MPI/CUDA开发环境搭建过程。

一、Linux

2.1 环境

操作系统Ubuntu 22.04.4 LTS
VS Code1.92.1
Git2.34.1
GCC11.4.0
CMake3.22.1

2.2 VS Code

下载VS Code,然后安装以下插件,

Task Explorer

Output Colorizer

Git Extension Pack

Git Graph

Remote Developement

Remote X11

C/C++ Extension Pack

C++ TestMate

Modern Fortran

FORTRAN InstelliSense

Fortran Breakpoint Support

Python Extension Pack
C# Dev Kit

Extension Pack for Intel Software Developer Tools

Nsight Visual Studio Code Edition

2.3 oneAPI

# download the key to system keyring
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB 
| gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/nullecho "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.listsudo apt updatesudo apt install intel-oneapi-base-toolkit
sudo apt install intel-oneapi-hpc-toolkit

2.4 CUDA

lspci | grep -i nvidia
uname -m && cat /etc/*release
gcc --versionwget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get install cuda-toolkit
sudo reboot

运行以下命令测试CUDA安装成功,

root@youquan:~# nvidia-smi 
Mon Dec 21 09:22:19 2024       
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.183.01             Driver Version: 535.183.01   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 4090        Off | 00000000:65:00.0 Off |                  Off |
| 30%   25C    P8              11W / 450W |     30MiB / 24564MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------++---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A      2217      G   /usr/lib/xorg/Xorg                            9MiB |
|    0   N/A  N/A      2657      G   /usr/bin/gnome-shell                         10MiB |
+---------------------------------------------------------------------------------------+

2.5 环境变量配置

添加以下环境变量到~/.bashrc文件,

# oneAPI
source /opt/intel/oneapi/setvars.sh --force# cuda
export C_INCLUDE_PATH=/usr/local/cuda/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/usr/local/cuda/include:$CPLUS_INCLUDE_PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda/bin:$PATH# sepcify configurations for CMake
export CC=icc
export CFLAGS=
export CXXFLAGS=
export FC=ifort
#export FFLAGS=
export CUDACXX=nvcc
export CUDAFLAGS=' -x cu -Xcompiler -march=native,-mavx '
export CUDAFLAGS=
export CUDAHOSTCXX=icpc
#export LDFLAGS=

二、Windows

2.1 环境

操作系统Windows 11
VS Code1.92.1
Git2.34.1
Visual StudioVisual Studio Community 2022
CMake3.22.1

2.2 oneAPI

从Intel官网下载并安装oneAPI Base Toolkit 与oneAPI HPC Toolkit

2.3 CUDA Toolkit

从NVIDIA官网下载并安装CUDA Toolki。

网络资料

oneAPIicon-default.png?t=O83Ahttps://www.intel.com/content/www/us/en/developer/tools/oneapi/overview.html

CUDA Zoneicon-default.png?t=O83Ahttps://developer.nvidia.com/cuda-zone/

NVIDIA CUDA Installation Guide for Linuxicon-default.png?t=O83Ahttps://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html


http://www.mrgr.cn/news/81072.html

相关文章:

  • 一起学Git【第一节:Git的安装】
  • Centos7安装k8s集群
  • VSCode:Markdown插件安装使用 -- 最简洁的VSCode中Markdown插件安装使用
  • Pytorch | 利用PI-FGSM针对CIFAR10上的ResNet分类器进行对抗攻击
  • TreeMap源码解析
  • Bcrypt在线密码加密生成器
  • Mapbox-GL 中 `token` 的使用
  • 单元测试使用记录
  • LLaMA-Factory 单卡3080*2 deepspeed zero3 微调Qwen2.5-7B-Instruct
  • 数据结构与算法再探(三)树
  • dockerfile文档编写(2):docker pull、apt install和pip镜像加速
  • EdgeX Core Service 核心服务之 Core Command 命令
  • xiaomiR4c openwrt
  • 2.6 网络面试问题
  • 音视频入门基础:AAC专题(13)——FFmpeg源码中,获取ADTS格式的AAC裸流音频信息的实现
  • strongswan测试证书生成
  • css
  • CDN信息收集(小迪网络安全笔记~
  • FLV视频封装格式详解
  • dockerfile文档编写(3):构建失败后清理缓存(删除容器和镜像相关命令)
  • Day13 用Excel表体验梯度下降法
  • 某狐畅游24校招-C++开发岗笔试(单选题)
  • 一起学Git【番外篇:如何在Git中新建文件】
  • 【全栈开发】----用pymysql库连接MySQL,批量存入
  • Vue3:uv-upload图片上传
  • 数智化医院分布式计算框架融合人工智能方向初步实现与能力转换浅析