CUDA 以及MPI并行矩阵乘连接服务器运算vscode配置

一、CUDA Vscode配置

(一)扩展安装

本地安装

服务器端安装

(二) CUDA 配置 .vscode

c_cpp_properties.json

cpp 复制代码
{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/local/bin/clang",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "linux-clang-x64"
        }
    ],
    "version": 4
}

launch.json

cpp 复制代码
{
      "configurations": [
            {
                  "name": "C/C++: g++ 生成和调试活动文件",
                  "type": "cppdbg",
                  "request": "launch",
                  "program": "${fileDirname}/${fileBasenameNoExtension}",
                  "args": [],
                  "stopAtEntry": false,
                  "cwd": "${fileDirname}",
                  "environment": [],
                  "externalConsole": false,
                  "MIMode": "gdb",
                  "setupCommands": [
                        {
                              "description": "为 gdb 启用整齐打印",
                              "text": "-enable-pretty-printing",
                              "ignoreFailures": true
                        },
                        {
                              "description": "将反汇编风格设置为 Intel",
                              "text": "-gdb-set disassembly-flavor intel",
                              "ignoreFailures": true
                        }
                  ],
                  "preLaunchTask": "C/C++: g++ 生成活动文件",
                  "miDebuggerPath": "/usr/bin/gdb"
            }
      ],
      "version": "2.0.0"
}

tasks.json

cpp 复制代码
{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "cppbuild",
			"label": "C/C++: g++ 生成活动文件",
			"command": "/usr/bin/g++",
			"args": [
				"-fdiagnostics-color=always",
				"-g",
				"${file}",
				"-o",
				"${fileDirname}/${fileBasenameNoExtension}"
			],
			"options": {
				"cwd": "${fileDirname}"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group": {
				"kind": "build",
				"isDefault": true
			},
			"detail": "编译器: /usr/bin/g++"
		}
	]
}

二、MPI

(一)安装扩展

本地安装和服务器端安装的扩展和CUDA一样

(二)Vscode配置

c_cpp_properties.json

cpp 复制代码
{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "/opt/intel/oneapi/mpi/2021.6.0/include" 
            ],
            "defines": [],
            "compilerPath": "/opt/rh/devtoolset-8/root/usr/bin/gcc",
            "cStandard": "c17",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "linux-gcc-x64"
        }
    ],
    "version": 4
}

launch.json

cpp 复制代码
{
      "configurations": [
            {
                  "name": "C/C++: g++ 生成和调试活动文件",
                  "type": "cppdbg",
                  "request": "launch",
                  "program": "${fileDirname}/${fileBasenameNoExtension}",
                  "args": [],
                  "stopAtEntry": false,
                  "cwd": "${fileDirname}",
                  "environment": [],
                  "externalConsole": false,
                  "MIMode": "gdb",
                  "setupCommands": [
                        {
                              "description": "为 gdb 启用整齐打印",
                              "text": "-enable-pretty-printing",
                              "ignoreFailures": true
                        },
                        {
                              "description": "将反汇编风格设置为 Intel",
                              "text": "-gdb-set disassembly-flavor intel",
                              "ignoreFailures": true
                        }
                  ],
                  "preLaunchTask": "C/C++: g++ 生成活动文件",
                  "miDebuggerPath": "/opt/rh/devtoolset-8/root/usr/bin/gdb"
            }
      ],
      "version": "2.0.0"
}

settings.json

cpp 复制代码
{
      "files.associations": {
            "iostream": "cpp",
            "ctime": "cpp",
            "ostream": "cpp"
      }
}

tasks.json

cpp 复制代码
{
      "tasks": [
            {
                  "type": "cppbuild",
                  "label": "C/C++: g++ 生成活动文件",
                  "command": "/opt/rh/devtoolset-8/root/usr/bin/g++",
                  "args": [
                        "-fdiagnostics-color=always",
                        "-g",
                        "${file}",
                        "-o",
                        "${fileDirname}/${fileBasenameNoExtension}"
                  ],
                  /* "run": {
                        "command": "mpirun",
                        "args": [
                            "-np",
                            "4",
                            "./$fileNameWithoutExt"
                        ]
                    }, */
                  "options": {
                        "cwd": "${fileDirname}"
                  },
                  "problemMatcher": [
                        "$gcc"
                  ],
                  "group": "build",
                  "detail": "调试器生成的任务。",
                  
            },
           
      ],
      "version": "2.0.0"
}
相关推荐
荒Huang1 小时前
Linux挖矿病毒(kswapd0进程使cpu爆满)
linux·运维·服务器
九河云1 小时前
如何选择适合的AWS EC2实例类型
服务器·云计算·aws
Mortal_hhh2 小时前
VScode的C/C++点击转到定义,不是跳转定义而是跳转声明怎么办?(内附详细做法)
ide·vscode·stm32·编辑器
其乐无涯3 小时前
服务器技术(一)--Linux基础入门
linux·运维·服务器
写bug的小屁孩3 小时前
前后端交互接口(三)
运维·服务器·数据库·windows·用户界面·qt6.3
斑布斑布3 小时前
【linux学习2】linux基本命令行操作总结
linux·运维·服务器·学习
紅色彼岸花3 小时前
第六章:DNS域名解析服务器
运维·服务器
Spring_java_gg3 小时前
如何抵御 Linux 服务器黑客威胁和攻击
linux·服务器·网络·安全·web安全
✿ ༺ ོIT技术༻3 小时前
Linux:认识文件系统
linux·运维·服务器
恒辉信达3 小时前
hhdb数据库介绍(8-4)
服务器·数据库·mysql