![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
并行计算
today__present
这个作者很懒,什么都没留下…
展开
-
利用CUDA计算向量与矩阵每一行的欧式距离
本文作为笔者的学习笔记,代码仅供参考。 代码实现:计算向量a(n维)到矩阵b(n*n)每一行的欧式距离,并将结果输出到向量c(n维)。 其中,向量a与矩阵b中的元素均规定为整数,输出的向量c中数据类型为浮点数。 具体如下: #include<stdio.h> #include<cuda.h> const int BLOCK_SIZE = 5; const int GRID_SIZE = 5; #define N 10 __global__ void dist(int *a,int原创 2020-12-06 16:54:31 · 545 阅读 · 2 评论 -
利用MIC做矩阵运算
本文用作学习笔记,仅做参考。 代码实现D=A*B+C的矩阵运算,A与B分别为n*m与m*n矩阵. 具体如下(本代码所用语言为C++): #include <stdio.h> #include <stdlib.h> #include <omp.h> #include <offload.h> //定义矩阵A的行数(N)与列数(M) #define N 5 #define M 5 //检测是否在mic上运行 __attribute__((target (mic原创 2020-12-06 16:28:28 · 492 阅读 · 0 评论