CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

problem in running multiple gpu

Open summerQing307 opened this issue 10 years ago • 4 comments

When i was running LM by cntk using the multiple gpu configuration, a strange exception occured which puzzled me a lot:

EXCEPTION occurred: Cannot move externally owned matrices to the preferred device

[CALL STACK] /aifs/users/qyw16/bin/cntk/CNTK/build/release/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::ExceptionWithCallStackstd::runtime_error::CollectCallStack(std::function<void (std::string)> const&, std::function<void ()> const&) + 0x101 ) [0x7f96662c4921] /aifs/users/qyw16/bin/cntk/CNTK/build/release/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::ExceptionWithCallStackstd::runtime_error::PrintCallStack() + 0x88 ) [0x7f96662c4db8] cntk ( void Microsoft::MSR::CNTK::ThrowFormattedstd::runtime_error(char const_, ...) + 0xe2 ) [0x5383e2] /aifs/users/qyw16/bin/cntk/CNTK/build/release/bin/../lib/libcntkmath.so ( + 0x1de731) [0x7f96661c1731] /aifs/users/qyw16/bin/cntk/CNTK/build/release/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::Matrix::MultiplyAndWeightedAdd(double, Microsoft::MSR::CNTK::Matrix const&, bool, Microsoft::MSR::CNTK::Matrix const&, bool, double, Microsoft::MSR::CNTK::Matrix&) + 0x4b ) [0x7f96661cd78b] /aifs/users/qyw16/bin/cntk/CNTK/build/release/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::Matrix::AssignProductOf(Microsoft::MSR::CNTK::Matrix const&, bool, Microsoft::MSR::CNTK::Matrix const&, bool) + 0x4d ) [0x7f96661cf09d] cntk ( Microsoft::MSR::CNTK::TimesNodeBase<double, false>::ForwardProp(Microsoft::MSR::CNTK::FrameRange const&) + 0x118 ) [0x5fd6e8] cntk ( Microsoft::MSR::CNTK::ComputationNetwork::PARTraversalFlowControlNode::ForwardProp(Microsoft::MSR::CNTK::FrameRange const&) + 0xe7 ) [0x6b6de7] cntk ( Microsoft::MSR::CNTK::ComputationNetwork::ForwardProp(std::shared_ptrMicrosoft::MSR::CNTK::ComputationNodeBase) + 0x8c ) [0x6b93dc] cntk ( Microsoft::MSR::CNTK::SimpleEvaluator::Evaluate(Microsoft::MSR::CNTK::IDataReader, std::vector<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > const&, unsigned long, unsigned long) + 0x7e8 ) [0x72c728] 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) + 0x15d6) [0x735046] 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) + 0x437 ) [0x736ac7] cntk ( void DoTrain<Microsoft::MSR::CNTK::ConfigParameters, double>(Microsoft::MSR::CNTK::ConfigParameters const&) + 0x22c ) [0x75845c] cntk ( void DoCommands(Microsoft::MSR::CNTK::ConfigParameters const&) + 0x814 ) [0x5930a4] cntk ( wmainOldCNTKConfig(int, wchar_t**) + 0xaf9 ) [0x5344e9] cntk ( wmain1(int, wchar_t**) + 0x70 ) [0x534980] cntk ( main + 0xd8 ) [0x529128] /lib64/libc.so.6 ( __libc_start_main + 0xf5 ) [0x7f966456fb15] cntk ( ) [0x52cf15] EXCEPTION occurred: Cannot move externally owned matrices to the preferred device

Could you give me a hand in sloving this problem? Thank you a lot.

summerQing307 avatar Feb 29 '16 03:02 summerQing307

Thanks for the report. Could you let me know more details:

Are sparse matrices involved?

Do you have the same error with single GPU?

If sparse and no error with single GPU, then the problem is that 1-bit SGD currently does not support sparse matrices. This is on our list, and should not be too complicated, but has not been completed yet, and workaround is to use dense matrices (which may, however, slow things down a lot).

From: summerQing307 [mailto:[email protected]] Sent: Sunday, February 28, 2016 19:07 To: Microsoft/CNTK [email protected] Subject: [CNTK] problem in running multiple gpu (#174)

When i was running LM by cntk using the multiple gpu configuration, a strange exception occured which puzzled me a lot:

EXCEPTION occurred: Cannot move externally owned matrices to the preferred device

[CALL STACK] /aifs/users/qyw16/bin/cntk/CNTK/build/release/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::ExceptionWithCallStackstd::runtime_error::CollectCallStack(std::function const&, std::function const&) + 0x101 ) [0x7f96662c4921] /aifs/users/qyw16/bin/cntk/CNTK/build/release/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::ExceptionWithCallStackstd::runtime_error::PrintCallStack() + 0x88 ) [0x7f96662c4db8] cntk ( void Microsoft::MSR::CNTK::ThrowFormattedstd::runtime_error(char const, ...) + 0xe2 ) [0x5383e2] /aifs/users/qyw16/bin/cntk/CNTK/build/release/bin/../lib/libcntkmath.so ( + 0x1de731) [0x7f96661c1731] /aifs/users/qyw16/bin/cntk/CNTK/build/release/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::Matrix::MultiplyAndWeightedAdd(double, Microsoft::MSR::CNTK::Matrix const&, bool, Microsoft::MSR::CNTK::Matrix const&, bool, double, Microsoft::MSR::CNTK::Matrix&) + 0x4b ) [0x7f96661cd78b] /aifs/users/qyw16/bin/cntk/CNTK/build/release/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::Matrix::AssignProductOf(Microsoft::MSR::CNTK::Matrix const&, bool, Microsoft::MSR::CNTK::Matrix const&, bool) + 0x4d ) [0x7f96661cf09d] cntk ( Microsoft::MSR::CNTK::TimesNodeBase::ForwardProp(Microsoft::MSR::CNTK::FrameRange const&) + 0x118 ) [0x5fd6e8] cntk ( Microsoft::MSR::CNTK::ComputationNetwork::PARTraversalFlowControlNode::ForwardProp(Microsoft::MSR::CNTK::FrameRange const&) + 0xe7 ) [0x6b6de7] cntk ( Microsoft::MSR::CNTK::ComputationNetwork::ForwardProp(std::shared_ptrMicrosoft::MSR::CNTK::ComputationNodeBase) + 0x8c ) [0x6b93dc] cntk ( Microsoft::MSR::CNTK::SimpleEvaluator::Evaluate(Microsoft::MSR::CNTK::IDataReader, std::vector, std::allocator >, std::allocator, std::allocator > > > const&, unsigned long, unsigned long) + 0x7e8 ) [0x72c728] 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) + 0x15d6) [0x735046] 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) + 0x437 ) [0x736ac7] cntk ( void DoTrain(Microsoft::MSR::CNTK::ConfigParameters const&) + 0x22c ) [0x75845c] cntk ( void DoCommands(Microsoft::MSR::CNTK::ConfigParameters const&) + 0x814 ) [0x5930a4] cntk ( wmainOldCNTKConfig(int, wchar_t) + 0xaf9 ) [0x5344e9] cntk ( wmain1(int, wchar_t) + 0x70 ) [0x534980] cntk ( main + 0xd8 ) [0x529128] /lib64/libc.so.6 ( __libc_start_main + 0xf5 ) [0x7f966456fb15] cntk ( ) [0x52cf15] EXCEPTION occurred: Cannot move externally owned matrices to the preferred device

Could you give me a hand in sloving this problem? Thank you a lot.

— Reply to this email directly or view it on GitHubhttps://github.com/Microsoft/CNTK/issues/174.

frankseide avatar Feb 29 '16 03:02 frankseide

@frankseide Yes, in this LM experiment, i am using one-hot, which may result in sparse matrix. Meanwhile,such problem may not occur in single gpu. By the way, could you tell how to transfer sparse matrix to dense matrix if needed? Thank you~

summerQing307 avatar Feb 29 '16 03:02 summerQing307

@frankseide hi,sorry to ask whether this problem has been solved?

summerQing307 avatar Mar 29 '16 07:03 summerQing307

I'm not sure if this has been resolved, but it's been very old. Please try the latest 2.0 release and see if there are still issues. Feel free to open a new issue if needed. Thanks!

wolfma61 avatar Jul 15 '17 08:07 wolfma61