我正在使用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)
{
}
}
}
答案 0 :(得分:1)
代码看起来正确,但如果您没有安装许可证,则会失败。您可以在nuget包的工具文件夹中找到许可证管理器可执行文件。