CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

problem running Tutorial2

Open scimg opened this issue 10 years ago • 5 comments

I am following the tutorial on https://github.com/Microsoft/CNTK/wiki/Tutorial2. The cntk version is CNTK-1-5-Windows-64bit-GPU.zip. The problem occurs when running the 01_OneHidden.cntk on CPU.

The scripts in the config file looks as

deviceId = 0
imageLayout = "cudnn"
# override the above as follows when running on CPU:
# deviceId = -1

I mean to run it on CPU, so I change them to

#deviceId = 0
#imageLayout = "cudnn"
# override the above as follows when running on CPU:
deviceId = -1

However, error occurs as

EXCEPTION occurred: No variable found with the name imageLayout.  Parsing of str
ing failed: 01_OneHidden.cntk:train:NDLNetworkBuilder:    W = ImageParameter(out
Dim, inW, inH, inC, init="uniform", initValueScale=parmScale, initOnCPUOnly=true
, imageLayout=$imageLayout$)

Seems something wrong with imageLayout, so I uncomment the imageLayout line as

#deviceId = 0
imageLayout = "cudnn"
# override the above as follows when running on CPU:
deviceId = -1

This time, another error occurs

No PreCompute nodes found, skipping PreCompute step.

Starting Epoch 1: learning rate per sample = 0.003125  effective momentum = 0.00
0000  momentum as time constant = 0.0 samples
BlockRandomizer::StartEpoch: epoch 0: frames [0..60000] (first sequence at sampl
e 0), data subset 0 of 1

Starting minibatch loop.

EXCEPTION occurred: AssignNumOfDiff: a and b must have the same number of rows.

What may the problem be? I don't have a supported GPU, so I don't know if it can run on GPU.

scimg avatar Jun 22 '16 08:06 scimg

The comment is misleading. As you correctly inferred, it was meant to refer to deviceId, not imageLayout. Convolution support is limited on CPU. You could try to set imageLayout="legacy" to see if it works. The "legacy" layout is supported on the CPU. However, I am not sure if all operations needed in this sample are supported. I recommend getting a GPU. The speed difference will make it worthwhile (make sure you get one with compute capability 3.0 or above).

frankseide avatar Jun 22 '16 12:06 frankseide

@scimg I have no problem running 01_OneHidden.cntk with CPU with the same setting (imageLayout = "cudnn" ,deviceId = -1) I use the ndl version though

@frankseide : 01_OneHidden.cntk uses no convolution so that might not be the case

jotarun avatar Jun 23 '16 01:06 jotarun

@scimg I managed to reproduce your error. It turns out if you failed to run the network with GPU, it will still produce a "leftover" model in Output/01_OneHidden.0 It will cause the error after you switch to CPU. Delete the model file will solve the problem. I think that is what you encountered.

jotarun avatar Jun 23 '16 03:06 jotarun

If that is the problem, then you can also say

makeMode=false

on the command line.

frankseide avatar Jun 23 '16 04:06 frankseide

@jotarun @frankseide Thank you! That's just the problem. The "makeMode" parameter makes it run correctly now.

scimg avatar Jun 23 '16 04:06 scimg