前言
Openpose 地址:Openpose主页
使用git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose
下载openpose
参考博客:https://blog.csdn.net/zb1165048017/article/details/82115724,https://blog.csdn.net/m0_37638031/article/details/78896818
【注】如果使用git时下载速度过慢,可以将openpose代码fork到国内的码云中后再clone
代码
git clone https://gitee.com/aydon/openpose.git
准备工作
需求工具
CMake
,Visual Studio 2019
,CUDA
,cudnn
在编写此文章时使用的版本为:
CMake
:3.15.0
CUDA
:10.1 CUDA10.1下载
cudnn
:cudnn-10.1-windows10-x64-v7.6.1.34,戳这里
安装CUDA及cudnn
CUDA
下载完成后,点击执行.exe
文件,接下来一直选择下一步即可。
安装完成后打开cmd
,输入nvcc -V
,显示如下则安装成功。最后一行显示版本号,图中是10.1.
打开Visual sutdio
新建工程,选择CUDA
模块
复制以下代码,替换kernel.cu
下的内容
// CUDA runtime 库 + CUBLAS 库
#include "cuda_runtime.h"
#include "cublas_v2.h"
#include <time.h>
#include <iostream>
using namespace std;
// 定义测试矩阵的维度
int const M = 5;
int const N = 10;
int main()
{
// 定义状态变量
cublasStatus_t status;
// 在内存中为将要计算的矩阵开辟空间
float *h_A = (float*)malloc(N*M * sizeof(float));
float *h_B = (float*)malloc(N*M * sizeof(float));
// 在 内存 中为将要存放运算结果的矩阵开辟空间
float *h_C = (float*)malloc(M*M