This repository was archived by the owner on Mar 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6cba0bd
Initial commit
iomaganaris b38ddf5
Code refactoring
iomaganaris 768e9be
Reverted back to NrnFastImem struct instead of two double arrays
iomaganaris 3d904d0
Small code changes
iomaganaris abf194f
Little code polishing
iomaganaris 891dd1a
Added i_membrane to neuron direct memory transfer and refactored
iomaganaris c07b04b
Renamed i_membrane enum to i_membrane_
iomaganaris 9abff72
Enable fast_imem calculation through report parsing and generate
iomaganaris e962735
Added fast_imem calculation to direct memory test
iomaganaris 2304e9a
Added small explanation about the mech_type enum
iomaganaris f0d2c3e
Revert "Added small explanation about the mech_type enum"
iomaganaris 36bcbb5
Addressesd review comments
iomaganaris b3c7b03
Addressed review comments
iomaganaris 6b280f1
Updated mod2c submodule commit
iomaganaris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,78 @@ | ||
/* | ||
Copyright (c) 2019, Blue Brain Project | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
1. Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
3. Neither the name of the copyright holder nor the names of its contributors | ||
may be used to endorse or promote products derived from this software | ||
without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include "coreneuron/nrnconf.h" | ||
#include "coreneuron/nrnoc/fast_imem.h" | ||
#include "coreneuron/nrniv/memory.h" | ||
#include "coreneuron/nrnmpi/nrnmpi.h" | ||
|
||
namespace coreneuron { | ||
|
||
extern int nrn_nthread; | ||
extern NrnThread *nrn_threads; | ||
bool nrn_use_fast_imem; | ||
|
||
void fast_imem_free() { | ||
for (NrnThread* nt = nrn_threads; nt < nrn_threads + nrn_nthread; ++nt) { | ||
if (nt->nrn_fast_imem) { | ||
free(nt->nrn_fast_imem->nrn_sav_rhs); | ||
free(nt->nrn_fast_imem->nrn_sav_d); | ||
free(nt->nrn_fast_imem); | ||
nt->nrn_fast_imem = nullptr; | ||
} | ||
} | ||
} | ||
|
||
void nrn_fast_imem_alloc() { | ||
if (nrn_use_fast_imem) { | ||
fast_imem_free(); | ||
for (NrnThread* nt = nrn_threads; nt < nrn_threads + nrn_nthread; ++nt) { | ||
int n = nt->end; | ||
nt->nrn_fast_imem = (NrnFastImem*)ecalloc(1, sizeof(NrnFastImem)); | ||
nt->nrn_fast_imem->nrn_sav_rhs = (double*)emalloc_align(n * sizeof(double)); | ||
nt->nrn_fast_imem->nrn_sav_d = (double*)emalloc_align(n * sizeof(double)); | ||
} | ||
} | ||
} | ||
|
||
void nrn_calc_fast_imem(NrnThread* nt) { | ||
int i1 = 0; | ||
int i3 = nt->end; | ||
|
||
double* vec_rhs = nt->_actual_rhs; | ||
double* vec_area = nt->_actual_area; | ||
|
||
double* fast_imem_d = nt->nrn_fast_imem->nrn_sav_d; | ||
double* fast_imem_rhs = nt->nrn_fast_imem->nrn_sav_rhs; | ||
for (int i = i1; i < i3 ; ++i) { | ||
fast_imem_rhs[i] = (fast_imem_d[i]*vec_rhs[i] + fast_imem_rhs[i])*vec_area[i]*0.01; | ||
} | ||
} | ||
|
||
} | ||
|
This file contains hidden or 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,63 @@ | ||
/* | ||
Copyright (c) 2019, Blue Brain Project | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
1. Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
3. Neither the name of the copyright holder nor the names of its contributors | ||
may be used to endorse or promote products derived from this software | ||
without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#ifndef fast_imem_h | ||
#define fast_imem_h | ||
|
||
#include "coreneuron/nrnoc/multicore.h" | ||
|
||
namespace coreneuron { | ||
|
||
/* Bool global variable to define if the fast_imem | ||
* calculations should be enabled. | ||
*/ | ||
extern bool nrn_use_fast_imem; | ||
|
||
/* Free memory allocated for the fast current membrane calculation. | ||
* Found in src/nrnoc/multicore.c in NEURON. | ||
*/ | ||
void fast_imem_free(); | ||
|
||
/* Allocate memory for the rhs and d arrays needed for the fast | ||
* current membrane calculation. | ||
* Found in src/nrnoc/multicore.c in NEURON. | ||
*/ | ||
static void fast_imem_alloc(); | ||
|
||
/* fast_imem_alloc() wrapper. | ||
* Found in src/nrnoc/multicore.c in NEURON. | ||
*/ | ||
void nrn_fast_imem_alloc(); | ||
|
||
/* Calculate the new values of rhs array at every timestep. | ||
* Found in src/nrnoc/fadvance.c in NEURON. | ||
*/ | ||
void nrn_calc_fast_imem(NrnThread* _nt); | ||
|
||
} // namespace coreneuron | ||
#endif //fast_imem_h |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.