我第一次使用 Alea GPU 研究一些 GPU 计算算法。我找不到licensemanager.exe文件来安装许可证。我已注册社区帐户并拥有许可证代码。我无法找到licensmanager.exe,因此出现编译器错误。附上图片供您参考。
有人可以请教我做错了什么吗?
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[AOTCompile]
static void SquareKernel(deviceptr<double> outputs, deviceptr<double> inputs, int n)
{
var start = blockIdx.x * blockDim.x + threadIdx.x;
var stride = gridDim.x * blockDim.x;
for (var i = start; i < n; i += stride)
{
outputs[i] = inputs[i] * inputs[i];
}
}
static double[] SquareGPU(double[] inputs)
{
var worker = Worker.Default;
using (var dInputs = worker.Malloc(inputs))
using (var dOutputs = worker.Malloc<double>(inputs.Length))
{
const int blockSize = 256;
var numSm = worker.Device.Attributes.MULTIPROCESSOR_COUNT;
var gridSize = Math.Min(16 * numSm, Common.divup(inputs.Length, blockSize));
var lp = new LaunchParam(gridSize, blockSize);
worker.Launch(SquareKernel, lp, dOutputs.Ptr, dInputs.Ptr, inputs.Length);
return dOutputs.Gather();
}
}
private void Form1_Load(object sender, EventArgs e)
{
try
{
var inputs = Enumerable.Range(0, 101).Select(i => -5.0 + i * 0.1).ToArray();
var outputs = SquareGPU(inputs);
Debug.Print("inputs = {0}", String.Join(", ", inputs));
Debug.Print("outputs = {0}", String.Join(", ", outputs));
}
catch(Exception ex)
{
}
}
}