我尝试在CUDA上编写一个项目,我想要使用几个常量,而不是来回传递它们。
我有一个类似
的Settings.cuh文件echo $this->Form->input('fecha_transporte', array(
'label' => '',
'dateFormat' => 'DMY',
'minYear' => date('Y'),
'maxYear' => date('Y')+5,
'orderYear' => 'asc',
'selected' => date('Y-m-1', strtotime("+30 days"))
)
);
这是一个无法读取fx的设备功能:
#ifndef _SETTINGS_
#define _SETTINGS_
#include <math.h>
#define sqr(a) ((a)*(a))
const float START_X = -1.5;
const float START_Y = 0;
const float START_Z = 0;
const float Delta = 0.1;
const float Epsilon = 0.015;
const float Low = 0.01;
const float Sigma = -log(Low) / sqr(Epsilon - Delta);
const float fx = 525;
const float fy = 525;
const float cx = 319.5;
const float cy = 239.5;
#endif
当我在.cu文件中包含它时,如果我尝试在设备函数中使用它,我得到错误标识符fx在设备代码中未定义。我试过.cuh和.h扩展,但没有一个工作。我有一些编译和运行的旧代码,在那里我只有一个文件parameters.cuh,我可以从中获取所有常量,包括主机和设备。
当然,我可以使用FX,但主要问题是它无法在Settings.cuh文件中看到变量。
以前,我使用的是Linux,但现在我使用的是Windows visual studio。