一段程序代码,需要改成cuda格式之行,可是效果非常差,希望大神看看

小牛牛K 小牛牛K 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
[code=c]__global__ void LU_SGS(double *temperature) {
int tx = threadIdx.x;
double Residual = NUM;
//int stableTimes = 0;
while (Residual > EPS)
{
Residual = 0.0;
for (int i = NUM - 2; i > 0; i--)
{
double preResidual = temperature[i];
temperature[i] = (temperature[i + 1] + temperature[i - 1]) / 2.0;
Residual += temperature[i] - preResidual;
}
for (int i = 1; i < NUM-1; i++)
{
double preResidual = temperature[i];
temperature[i] = (temperature[i + 1] + temperature[i - 1]) / 2.0;
Residual += temperature[i] - preResidual;
}
//stableTimes++;
}
}
/code]
...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
小牛牛K
CUDA 591 成员 2,925 内容