multi-gpu模型初始化代码:
local dpt = nn.DataParallelTable(1, true, true)
:add(model, gpus)
:threads(function()
local cudnn = require 'cudnn'
cudnn.fastest, cudnn.benchmark = fastest, benchmark
end)
dpt.gradInput = nil
model = dpt:cuda()
处理model:parameters()
或model:getParameters()
时出错:
FATAL THREAD PANIC: (read) /home/daniel/torch/install/share/lua/5.2/torch/File.lua:343: unknown Torch class <nn.Reorg>
FATAL THREAD PANIC: (read) /home/daniel/torch/install/share/lua/5.2/torch/File.lua:343: unknown Torch class <nn.Reorg>
<nn.Reorg>
是我在models/Reorg.lua
中定义的自定义图层,它只对图层输入执行简单的复制操作。
它在CPU和单GPU情况下工作正常。
答案 0 :(得分:0)
我终于明白了,只需添加一行代码:
:threads(function()
require 'models/Reorg'
local cudnn = require 'cudnn'
cudnn.fastest, cudnn.benchmark = fastest, benchmark
end)
线程没有加载文件(为什么???),我必须手动加载...