New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prohibit DataConnect in multithreaded mode. #776
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -864,6 +864,12 @@ NestModule::DataConnect_i_D_sFunction::execute( SLIInterpreter* i ) const | |
{ | ||
i->assert_stack_load( 3 ); | ||
|
||
if ( kernel().vp_manager.get_num_threads() > 1 ) | ||
{ | ||
throw KernelException( | ||
"DataConnect can not be used with multiple threads" ); | ||
} | ||
|
||
const index source = getValue< long >( i->OStack.pick( 2 ) ); | ||
DictionaryDatum params = getValue< DictionaryDatum >( i->OStack.pick( 1 ) ); | ||
const Name synmodel_name = getValue< std::string >( i->OStack.pick( 0 ) ); | ||
|
@@ -922,6 +928,13 @@ void | |
NestModule::DataConnect_aFunction::execute( SLIInterpreter* i ) const | ||
{ | ||
i->assert_stack_load( 1 ); | ||
|
||
if ( kernel().vp_manager.get_num_threads() > 1 ) | ||
{ | ||
throw KernelException( | ||
"DataConnect can not be used with multiple threads" ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
const ArrayDatum connectome = getValue< ArrayDatum >( i->OStack.top() ); | ||
|
||
kernel().connection_manager.data_connect_connectome( connectome ); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* issue-527.sli | ||
* | ||
* This file is part of NEST. | ||
* | ||
* Copyright (C) 2004 The NEST Initiative | ||
* | ||
* NEST is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* NEST is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with NEST. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
|
||
/* BeginDocumentation | ||
Name: testsuite::issue-527 | ||
|
||
Synopsis: (issue-527) run -> NEST exits if test fails | ||
|
||
Description: | ||
This test ensures that NEST raises an error if the user tries to use | ||
DataConnect in multithreaded mode. | ||
|
||
Author: Stine B. Vennemo | ||
FirstVersion: July 2017 | ||
SeeAlso: | ||
*/ | ||
|
||
(unittest) run | ||
/unittest using | ||
|
||
skip_if_not_threaded | ||
|
||
/test_threaded_DataConnect | ||
{ | ||
dup /threads Set | ||
ResetKernel | ||
0 << /local_num_threads threads /total_num_virtual_procs threads >> SetStatus | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to set |
||
|
||
% Create set of neurons | ||
/A /iaf_psc_alpha 1 Create def | ||
/B /iaf_psc_alpha 1000 Create def | ||
|
||
% Make target array | ||
/t [A 1 add 1.0 mul B 1.0 mul] Range def | ||
|
||
% Make weight array | ||
/w [1000] 1.0 LayoutArray def | ||
|
||
% Make delay array | ||
/d [1000] 1.0 LayoutArray def | ||
|
||
% Connect using DataConnect | ||
A << /target t /weight w /delay d >> /static_synapse DataConnect | ||
|
||
} def | ||
|
||
/* test runs with different number of threads */ | ||
[2 16 2] Range | ||
{ | ||
{ test_threaded_DataConnect } fail_or_die | ||
} | ||
forall | ||
|
||
endusing |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cannot