Not running on multiple GPUs
I have tried to run the binaries with and without 1 bit quantization along with the one built from source, but nothing ran to completion with multiple GPUs. Model used: sample Alexnet code Sucess: Runs on 2 GPUs (mpiexec -n 2 parallelTrain=true) Failure: Does not run with 8 GPUs with the same code. Note that I have multiple GPUs connected to the same machine.
Any suggestion?
Is there an error message you could share? Ideally a call stack. Thanks!
I have tried running the following command with 2,4,8 GPUs. Although it runs for the first two cases, but fails on the one with 8. I have 16 GPUs connected to one machine.
mpiexec -n 2 cntk configFile=AlexNet.cntk configName=AlexNet parallelTrain=true
mpiexec -n 4 cntk configFile=AlexNet.cntk configName=AlexNet parallelTrain=true
mpiexec -n 8 cntk configFile=AlexNet.cntk configName=AlexNet parallelTrain=true
Here is the call stack and error:
[CALL STACK]
/home/saoni.m/CNTK-2016-02-08-Linux-64bit-GPU-1bit-SGD/cntk/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::DebugUtil::PrintCallStack() + 0xbf ) [0x2aaaab722b1f]
cntk ( void Microsoft::MSR::CNTK::ThrowFormattedstd::logic_error(char const_, ...) + 0xdd ) [0x53d99d]
/home/saoni.m/CNTK-2016-02-08-Linux-64bit-GPU-1bit-SGD/cntk/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::GPUMatrix
EXCEPTION occurred: GetCublasHandle: Maximum GPU exceeded
This is hardcoded in GPUMatrix.h:
static const int MaxGpus = 8; // support up to 8 GPUs
I think it's historical thing - when CNTK started, it was hard to find machines with >= 8 GPUs. It can be safely changed to 16. Note that this limits number of GPUs per machine. You can have 16 machines with 4 GPUs each and CNTK will work just fine.
@Alexey-Kamenev : so this can only be changed in source installation?
Yes, however, other users stumbled on this as well - there is even an old pull request: https://github.com/Microsoft/CNTK/pull/172 Let me merge it with the master...
FYI, I've just merged that pull request, bumped up number of GPUs on a single node to 16. Let me know if that works for you.
Thank you @Alexey-Kamenev
However, I still cant run on 8 (which was already equal to MaxGpus being equal to 8).
The command I used: mpiexec -n 8 cntk configFile=AlexNet.cntk configName=AlexNet parallelTrain=true
The log file ended on: Validating --> Err = ErrorPrediction(labels[1000 x *], OutputNodes.z[1000 x *]) -> [1]
18 out of 48 nodes do not share the minibatch layout with the input data.
Post-processing network complete.
SGD using GPU 3.
Training criterion node(s): CE = CrossEntropyWithSoftmax
Evaluation criterion node(s): Err = ErrorPrediction
Allocating matrices for forward and/or backward propagation. No PreCompute nodes found, skipping PreCompute step Set Max Temp Mem Size For Convolution Nodes to 0 samples. Starting Epoch 1: learning rate per sample = 0.000039 effective momentum = 0.900000 momentum as time constant = 2429.8 samples
Starting minibatch loop, DataParallelSGD training (MyRank = 7, NumNodes = 8, NumGradientBits = 32), distributed reading is ENABLED.
The std output: ........ MPIWrapper: initializing MPI MPIWrapper: initializing MPI MPIWrapper: initializing MPI MPIWrapper: initializing MPI MPIWrapper: initializing MPI MPIWrapper: initializing MPI MPIWrapper: initializing MPI MPIWrapper: initializing MPI ping [requestnodes (before change)]: 8 nodes pinging each other ping [requestnodes (before change)]: 8 nodes pinging each other ping [requestnodes (before change)]: 8 nodes pinging each other ping [requestnodes (before change)]: 8 nodes pinging each other ping [requestnodes (before change)]: 8 nodes pinging each other ping [requestnodes (before change)]: 8 nodes pinging each other ping [requestnodes (before change)]: 8 nodes pinging each other ping [requestnodes (before change)]: 8 nodes pinging each other ping [requestnodes (before change)]: all 8 nodes responded requestnodes [MPIWrapper]: using 8 out of 8 MPI nodes (8 requested); we (0) are in (participating) ping [requestnodes (after change)]: 8 nodes pinging each other ping [requestnodes (before change)]: all 8 nodes responded requestnodes [MPIWrapper]: using 8 out of 8 MPI nodes (8 requested); we (6) are in (participating) ping [requestnodes (after change)]: 8 nodes pinging each other ping [requestnodes (before change)]: all 8 nodes responded requestnodes [MPIWrapper]: using 8 out of 8 MPI nodes (8 requested); we (2) are in (participating) ping [requestnodes (after change)]: 8 nodes pinging each other ping [requestnodes (before change)]: all 8 nodes responded requestnodes [MPIWrapper]: using 8 out of 8 MPI nodes (8 requested); we (3) are in (participating) ping [requestnodes (after change)]: 8 nodes pinging each other ping [requestnodes (before change)]: all 8 nodes responded requestnodes [MPIWrapper]: using 8 out of 8 MPI nodes (8 requested); we (7) are in (participating) ping [requestnodes (after change)]: 8 nodes pinging each other ping [requestnodes (before change)]: all 8 nodes responded requestnodes [MPIWrapper]: using 8 out of 8 MPI nodes (8 requested); we (4) are in (participating) ping [requestnodes (after change)]: 8 nodes pinging each other ping [requestnodes (before change)]: all 8 nodes responded requestnodes [MPIWrapper]: using 8 out of 8 MPI nodes (8 requested); we (1) are in (participating) ping [requestnodes (after change)]: 8 nodes pinging each other ping [requestnodes (before change)]: all 8 nodes responded requestnodes [MPIWrapper]: using 8 out of 8 MPI nodes (8 requested); we (5) are in (participating) ping [requestnodes (after change)]: 8 nodes pinging each other ping [requestnodes (after change)]: all 8 nodes responded mpihelper: we are cog 5 in a gearbox of 8 ping [mpihelper]: 8 nodes pinging each other ping [requestnodes (after change)]: all 8 nodes responded mpihelper: we are cog 7 in a gearbox of 8 ping [mpihelper]: 8 nodes pinging each other ping [requestnodes (after change)]: all 8 nodes responded mpihelper: we are cog 1 in a gearbox of 8 ping [mpihelper]: 8 nodes pinging each other ping [mpihelper]: all 8 nodes responded ping [requestnodes (after change)]: all 8 nodes responded mpihelper: we are cog 4 in a gearbox of 8 ping [mpihelper]: 8 nodes pinging each other ping [mpihelper]: all 8 nodes responded ping [requestnodes (after change)]: all 8 nodes responded mpihelper: we are cog 0 in a gearbox of 8 ping [mpihelper]: 8 nodes pinging each other ping [mpihelper]: all 8 nodes responded Redirecting stderr to file ./Output/AlexNet_Train_AddTop5Eval_Test.logrank0 ping [requestnodes (after change)]: all 8 nodes responded mpihelper: we are cog 6 in a gearbox of 8 ping [mpihelper]: 8 nodes pinging each other ping [mpihelper]: all 8 nodes responded ping [requestnodes (after change)]: all 8 nodes responded mpihelper: we are cog 2 in a gearbox of 8 ping [mpihelper]: 8 nodes pinging each other ping [mpihelper]: all 8 nodes responded ping [requestnodes (after change)]: all 8 nodes responded mpihelper: we are cog 3 in a gearbox of 8 ping [mpihelper]: 8 nodes pinging each other ping [mpihelper]: all 8 nodes responded ping [mpihelper]: all 8 nodes responded ping [mpihelper]: all 8 nodes responded Redirecting stderr to file ./Output/AlexNet_Train_AddTop5Eval_Test.logrank1 Redirecting stderr to file ./Output/AlexNet_Train_AddTop5Eval_Test.logrank2 Redirecting stderr to file ./Output/AlexNet_Train_AddTop5Eval_Test.logrank3 Redirecting stderr to file ./Output/AlexNet_Train_AddTop5Eval_Test.logrank4 Redirecting stderr to file ./Output/AlexNet_Train_AddTop5Eval_Test.logrank5 Redirecting stderr to file ./Output/AlexNet_Train_AddTop5Eval_Test.logrank6
Redirecting stderr to file ./Output/AlexNet_Train_AddTop5Eval_Test.logrank7
Primary job terminated normally, but 1 process returned
a non-zero exit code.. Per user-direction, the job has been aborted.
Do you see any error (exception/stack trace) in any of those rank logs?
Here is the call stack: (I missed earlier)
Starting minibatch loop, DataParallelSGD training (MyRank = 7, NumNodes = 8, NumGradientBits = 32), distributed reading is ENABLED.
[CALL STACK]
/home/saoni.m/CNTK-2016-02-08-Linux-64bit-GPU-1bit-SGD/cntk/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::DebugUtil::PrintCallStack() + 0xbf ) [0x2aaaab722b1f]
cntk ( void Microsoft::MSR::CNTK::ThrowFormattedstd::logic_error(char const_, ...) + 0xdd ) [0x53d99d]
/home/saoni.m/CNTK-2016-02-08-Linux-64bit-GPU-1bit-SGD/cntk/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::GPUMatrix
EXCEPTION occurred: GetCublasHandle: Maximum GPU exceeded
Right, so it looks like it's the same error (exception is thrown in GPUMatrix.cu, line 871). Unfortunately, I don't have a machine with 8 GPUs nearby, I'll need to ask our lab to build it so it will take time. If you are willing to debug the issue, the simplest way to do that is either attach gdb with breakpoint on that line or just add tracing (printf).
The issue has been dormant for a long while and CNTK improved significantly since then. Please open a new issue if you still experience problems in the latest release.