3
科学计算应用
hipblasIdamin 无法识别
2022-01-10 21:15:54
144

添加#include <hipblas.h>头文件后,既然能够提示hipblasIdamax为什么不能识别hipblasIdamin

TimeStepGPU.cu:35:2: error: use of undeclared identifier 'hipblasIdamin'; did you mean 'hipblasIdamax'?
hipblasIdamin(handle1,gmeshl,d_gcb,1,&idex);
~~~~~~~~~
hipblasIdamax

TimeStepGPU.cu:

#include "hip/hip_runtime.h"
////////////////////////////////////////////////////////////////////////
// 在GPU上求最所有单元时间步长中的最小值

////////////////////////////////////////////////////////////////////////

// Include, culbas_v2
#include <hipblas.h>

//#include "CalculateAreaGPU.cu"
#include <stdio.h>
//#include "CalculateEndg.cu"
global void CalculateEndg(int numel, int gnnode, int ndf, int *ix, double *x, double *gcb);

extern "C"
void TimeStepGPU(int gmeshl, int gnnode, int ndf, int *d_ix, double *d_x,double &gdt1,double &gdt2, double gyms, double gro)
{
static bool frist = true;
static double d_gcb;
static hipblasHandle_t handle1;
int idex; double tempmin;
if(frist)
{
hipMalloc((void**)&d_gcb,sizeof(double)
gmeshl);
// Init cublas
hipblasCreate(&handle1);
frist = false;
}

const unsigned int numThreadsTS=256;
const unsigned int numBlocksTS=(gmeshl+numThreadsTS-1)/numThreadsTS;
//hipLaunchKernelGGL(TimeStepGPU_GetArea, dim3(numBlocksTS), dim3(numThreadsTS), 0, 0, gmeshl,ndf,d_ix,d_x,d_gcb);
hipLaunchKernelGGL(CalculateEndg, dim3(numBlocksTS), dim3(numThreadsTS), 0, 0, gmeshl,gnnode,ndf,d_ix,d_x,d_gcb);
// 找到最小的值
hipblasIdamin(handle1,gmeshl,d_gcb,1,&idex);

hipblasGetVector(1,sizeof(double),&d_gcb[idex-1],1,&tempmin,1);
//最终计算时间步长
double wv = sqrt(gyms/gro);
gdt2 = gdt1;
gdt1 = 0.6 * tempmin / wv;
//gdt1 = tempmin / wv;

}

全部评论(8)
只看楼主
T
tianlh
4楼

看起来是函数没有提前声明,是不是include文件漏掉了?

2022/1/12
T
tianlh
3楼

TimeStepGPU.cu中的hipblasIdamin改成hipblasIdamax,会有报错吗?

2022/1/12
G
ghfund_1_a5
回复 @tianlh

改成hipblasldmax编译成功,这个函数是#include <hipblas.h>里的,不应该只有max没有min。

2022/1/12
T
tianlh
回复 @tianlh

您用的哪个版本的rocm呢,刚检查了下,平台上rocm3.x以上版本的hipblas.h有对hipblasIdamin和max的定义,rocm2.x版本只有hipblasIdamax。您可以module list 看下rocm版本,建议使用dtk21.04版本编译,加载指令为module switch compiler/rocm/dtk-21.04

2022/1/12
G
ghfund_1_a5
回复 @tianlh

我用的是2.9的版本

2022/1/12
全部4条回复
G
ghdevadmin
2楼

可以将相关代码截图发在上面,这样大家好清晰了解问题情况,左侧有编辑按钮,可进行添加

2022/1/11
A
aiss
1楼

您好,根据您现有描述暂时无法确定问题原因。如果问题还未解决,可以分享下TimeStepGPU.cu文件我们共同分析一下。谢谢!

2022/1/11
没有更多内容了
--
楼主
Level.1
0 帖子
楼主热帖
暂无数据