CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

Not running on multiple GPUs

Open saonim opened this issue 10 years ago • 11 comments

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?

saonim avatar Mar 24 '16 21:03 saonim

Is there an error message you could share? Ideally a call stack. Thanks!

frankseide avatar Mar 24 '16 22:03 frankseide

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::GetCublasHandle(int) + 0xcc ) [0x2aaaab658d1c] /home/saoni.m/CNTK-2016-02-08-Linux-64bit-GPU-1bit-SGD/cntk/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::GPUMatrix::MultiplyAndWeightedAdd(float, Microsoft::MSR::CNTK::GPUMatrix const&, bool, Microsoft::MSR::CNTK::GPUMatrix const&, bool, float, Microsoft::MSR::CNTK::GPUMatrix&) + 0x8a ) [0x2aaaab6778ea] /home/saoni.m/CNTK-2016-02-08-Linux-64bit-GPU-1bit-SGD/cntk/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::Matrix::MultiplyAndWeightedAdd(float, Microsoft::MSR::CNTK::Matrix const&, bool, Microsoft::MSR::CNTK::Matrix const&, bool, float, Microsoft::MSR::CNTK::Matrix&) + 0x51b ) [0x2aaaab616e1b] /home/saoni.m/CNTK-2016-02-08-Linux-64bit-GPU-1bit-SGD/cntk/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::Matrix::AssignProductOf(Microsoft::MSR::CNTK::Matrix const&, bool, Microsoft::MSR::CNTK::Matrix const&, bool) + 0x4d ) [0x2aaaab61820d] cntk ( Microsoft::MSR::CNTK::TimesNodeBase<float, false>::ForwardProp(Microsoft::MSR::CNTK::FrameRange const&) + 0xf8 ) [0x5ff368] cntk ( Microsoft::MSR::CNTK::ComputationNetwork::PARTraversalFlowControlNode::ForwardProp(Microsoft::MSR::CNTK::FrameRange const&) + 0xd3 ) [0x6b54b3] cntk ( Microsoft::MSR::CNTK::ComputationNetwork::ForwardProp(std::shared_ptrMicrosoft::MSR::CNTK::ComputationNodeBase) + 0x7c ) [0x6b787c] cntk ( Microsoft::MSR::CNTK::SGD::TrainOneEpoch(std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNodeBase const&, int, unsigned long, Microsoft::MSR::CNTK::IDataReader, double, unsigned long, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::map<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, Microsoft::MSR::CNTK::Matrix, std::less<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::allocator<std::pair<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, Microsoft::MSR::CNTK::Matrix> > >, std::liststd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::listMicrosoft::MSR::CNTK::Matrix<float, std::allocatorMicrosoft::MSR::CNTK::Matrix >&, double&, std::vector<double, std::allocator >&, unsigned long&, std::string) + 0xa0c ) [0x73842c] cntk ( Microsoft::MSR::CNTK::SGD::TrainOrAdaptModel(int, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, bool, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNodeBase, Microsoft::MSR::CNTK::IDataReader, Microsoft::MSR::CNTK::IDataReader) + 0x1244) [0x73d2f4] cntk ( Microsoft::MSR::CNTK::SGD::Train(std::functionstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNetwork (int)>, int, Microsoft::MSR::CNTK::IDataReader, Microsoft::MSR::CNTK::IDataReader, bool) + 0x424 ) [0x73f0f4] cntk ( void DoTrain<Microsoft::MSR::CNTK::ConfigParameters, float>(Microsoft::MSR::CNTK::ConfigParameters const&) + 0x22c ) [0x75727c] cntk ( void DoCommands(Microsoft::MSR::CNTK::ConfigParameters const&) + 0x81c ) [0x59446c] cntk ( wmainOldCNTKConfig(int, wchar_t__) + 0x909 ) [0x535ab9] cntk ( wmain1(int, wchar_t_*) + 0x68 ) [0x536108] cntk ( main + 0xd8 ) [0x529aa8] /cm/images/usr/lib64/libc.so.6 ( __libc_start_main + 0xf5 ) [0x2aaab11f9af5] cntk ( ) [0x52da47]

EXCEPTION occurred: GetCublasHandle: Maximum GPU exceeded

saonim avatar Mar 31 '16 22:03 saonim

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 avatar Apr 01 '16 00:04 Alexey-Kamenev

@Alexey-Kamenev : so this can only be changed in source installation?

saonim avatar Apr 01 '16 16:04 saonim

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...

Alexey-Kamenev avatar Apr 01 '16 17:04 Alexey-Kamenev

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.

Alexey-Kamenev avatar Apr 01 '16 18:04 Alexey-Kamenev

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.

saonim avatar Apr 01 '16 18:04 saonim

Do you see any error (exception/stack trace) in any of those rank logs?

Alexey-Kamenev avatar Apr 01 '16 19:04 Alexey-Kamenev

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::GetCublasHandle(int) + 0xcc ) [0x2aaaab658d1c] /GPAF_Extended/saoni.m/CNTK-2016-02-08-Linux-64bit-GPU-1bit-SGD/cntk/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::GPUMatrix::MultiplyAndWeightedAdd(float, Microsoft::MSR::CNTK::GPUMatrix const&, bool, Microsoft::MSR::CNTK::GPUMatrix const&, bool, float, Microsoft::MSR::CNTK::GPUMatrix&) + 0x8a ) [0x2aaaab6778ea] /home/saoni.m/CNTK-2016-02-08-Linux-64bit-GPU-1bit-SGD/cntk/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::Matrix::MultiplyAndWeightedAdd(float, Microsoft::MSR::CNTK::Matrix const&, bool, Microsoft::MSR::CNTK::Matrix const&, bool, float, Microsoft::MSR::CNTK::Matrix&) + 0x51b ) [0x2aaaab616e1b] /home/saoni.m/CNTK-2016-02-08-Linux-64bit-GPU-1bit-SGD/cntk/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::Matrix::AssignProductOf(Microsoft::MSR::CNTK::Matrix const&, bool, Microsoft::MSR::CNTK::Matrix const&, bool) + 0x4d ) [0x2aaaab61820d] cntk ( Microsoft::MSR::CNTK::TimesNodeBase<float, false>::ForwardProp(Microsoft::MSR::CNTK::FrameRange const&) + 0xf8 ) [0x5ff368] cntk ( Microsoft::MSR::CNTK::ComputationNetwork::PARTraversalFlowControlNode::ForwardProp(Microsoft::MSR::CNTK::FrameRange const&) + 0xd3 ) [0x6b54b3] cntk ( Microsoft::MSR::CNTK::ComputationNetwork::ForwardProp(std::shared_ptrMicrosoft::MSR::CNTK::ComputationNodeBase) + 0x7c ) [0x6b787c] cntk ( Microsoft::MSR::CNTK::SGD::TrainOneEpoch(std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNodeBase const&, int, unsigned long, Microsoft::MSR::CNTK::IDataReader, double, unsigned long, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::map<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, Microsoft::MSR::CNTK::Matrix, std::less<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::allocator<std::pair<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, Microsoft::MSR::CNTK::Matrix> > >, std::liststd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::listMicrosoft::MSR::CNTK::Matrix<float, std::allocatorMicrosoft::MSR::CNTK::Matrix >&, double&, std::vector<double, std::allocator >&, unsigned long&, std::string) + 0xa0c ) [0x73842c] cntk ( Microsoft::MSR::CNTK::SGD::TrainOrAdaptModel(int, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, bool, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNodeBase, Microsoft::MSR::CNTK::IDataReader, Microsoft::MSR::CNTK::IDataReader) + 0x1244) [0x73d2f4] cntk ( Microsoft::MSR::CNTK::SGD::Train(std::functionstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNetwork (int)>, int, Microsoft::MSR::CNTK::IDataReader, Microsoft::MSR::CNTK::IDataReader, bool) + 0x424 ) [0x73f0f4] cntk ( void DoTrain<Microsoft::MSR::CNTK::ConfigParameters, float>(Microsoft::MSR::CNTK::ConfigParameters const&) + 0x22c ) [0x75727c] cntk ( void DoCommands(Microsoft::MSR::CNTK::ConfigParameters const&) + 0x81c ) [0x59446c] cntk ( wmainOldCNTKConfig(int, wchar_t__) + 0x909 ) [0x535ab9] cntk ( wmain1(int, wchar_t_*) + 0x68 ) [0x536108] cntk ( main + 0xd8 ) [0x529aa8] /cm/images/SAL-default-image/usr/lib64/libc.so.6 ( __libc_start_main + 0xf5 ) [0x2aaab11f9af5] cntk ( ) [0x52da47]

EXCEPTION occurred: GetCublasHandle: Maximum GPU exceeded

saonim avatar Apr 01 '16 20:04 saonim

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).

Alexey-Kamenev avatar Apr 01 '16 21:04 Alexey-Kamenev

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.

wolfma61 avatar Jun 29 '17 12:06 wolfma61