Skip to content

Commit

Permalink
Merge branch 'master' into doxygen_doc_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kanishk16 authored May 29, 2020
2 parents aca5dfc + dcc20ae commit 28e923f
Show file tree
Hide file tree
Showing 178 changed files with 10,352 additions and 4,303 deletions.
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ for(b = 0; b < builderNodes.size(); b++) {
virtualenv virtualenv
. virtualenv/bin/activate
pip install "numpy>1.6, < 1.15"
pip install "numpy>=1.10.0,!=1.16.*"
python setup.py clean --all
python setup.py bdist_wheel -d . 1>> "${uniqueMsg}" 2>> "${uniqueMsg}"
Expand Down Expand Up @@ -282,7 +282,7 @@ for(b = 0; b < builderNodes.size(); b++) {
call activate
popd
pip install numpy
pip install "numpy>1.6, < 1.15"
copy /Y lib\\genn*Release_DLL.* pygenn\\genn_wrapper
Expand Down
69 changes: 38 additions & 31 deletions bin/genn-buildmodel.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ echo genn-buildmodel.bat [cdho] model
echo -c only generate simulation code for the CPU
echo -d enables the debugging mode
echo -h shows this help message
echo -s build GeNN without SDL checks
echo -o outpath changes the output directory
echo -i includepath add additional include directories (seperated by semicolons)
goto :eof
Expand All @@ -19,7 +20,7 @@ rem :: define genn-buildmodel.bat options separated by spaces
rem :: -<option>: option
rem :: -<option>:"" option with argument
rem :: -<option>:"<default>" option with argument and default value
set "OPTIONS=-o:"%CD%" -i:"" -d: -c: -h:"
set "OPTIONS=-o:"%CD%" -i:"" -d: -c: -h: -s:"
for %%O in (%OPTIONS%) do for /f "tokens=1,* delims=:" %%A in ("%%O") do set "%%A=%%~B"

:genn_option
Expand Down Expand Up @@ -54,54 +55,60 @@ if not defined MODEL (
)
for /f %%I in ("%-o%") do set "-o=%%~fI"
for /f %%I in ("%-i%") do set "-i=%%~fI"
for /f %%I in ("%MODEL%") do set "MACROS=/p:ModelFile=%%~fI /p:GeneratePath=%-o% /p:BuildModelInclude=%-i%"
for /f %%I in ("%MODEL%") do set "MACROS=/p:ModelFile="%%~fI" /p:GeneratePath="%-o%" /p:BuildModelInclude="%-i%""

if defined -d (
set "BACKEND_MACROS= /p:Configuration=Debug"
if defined -c (
set "BACKEND_PROJECT=single_threaded_cpu_backend"
set "MACROS=%MACROS% /p:Configuration=Debug"
set GENERATOR=.\generator_Debug.exe
) else (
set "BACKEND_PROJECT=cuda_backend"
set "MACROS=%MACROS% /p:Configuration=Debug_CUDA"
set GENERATOR=.\generator_Debug_CUDA.exe
)
rem set SDL check flag
if defined -s (
set "MACROS=%MACROS% /p:BuildModelSDLCheck=false"
) else (
set "BACKEND_MACROS= /p:Configuration=Release"
if defined -c (
set "BACKEND_PROJECT=single_threaded_cpu_backend"
set "MACROS=%MACROS% /p:Configuration=Release"
set GENERATOR=.\generator_Release.exe
) else (
set "BACKEND_PROJECT=cuda_backend"
set "MACROS=%MACROS% /p:Configuration=Release_CUDA"
set GENERATOR=.\generator_Release_CUDA.exe
)
set "MACROS=%MACROS% /p:BuildModelSDLCheck=true"
)

if defined -d (
set "BACKEND_MACROS= /p:Configuration=Debug"
if defined -c (
set "BACKEND_PROJECT=single_threaded_cpu_backend"
set "MACROS=%MACROS% /p:Configuration=Debug"
set GENERATOR=.\generator_Debug.exe
) else (
set "BACKEND_PROJECT=cuda_backend"
set "MACROS=%MACROS% /p:Configuration=Debug_CUDA"
set GENERATOR=.\generator_Debug_CUDA.exe
)
) else (
set "BACKEND_MACROS= /p:Configuration=Release"
if defined -c (
set "BACKEND_PROJECT=single_threaded_cpu_backend"
set "MACROS=%MACROS% /p:Configuration=Release"
set GENERATOR=.\generator_Release.exe
) else (
set "BACKEND_PROJECT=cuda_backend"
set "MACROS=%MACROS% /p:Configuration=Release_CUDA"
set GENERATOR=.\generator_Release_CUDA.exe
)
)

rem :: build backend
msbuild "%GENN_PATH%..\genn.sln" /m /verbosity:minimal /t:%BACKEND_PROJECT% %BACKEND_MACROS% /p:BuildProjectReferences=true && (
echo Successfully built GeNN
echo Successfully built GeNN
) || (
echo Unable to build GeNN
goto :eof
echo Unable to build GeNN
goto :eof
)


rem :: build generator
msbuild "%GENN_PATH%..\src\genn\generator\generator.vcxproj" /m /verbosity:minimal %MACROS%&& (
echo Successfully built code generator
echo Successfully built code generator
) || (
echo Unable to build code generator
goto :eof
echo Unable to build code generator
goto :eof
)

if defined -d (
devenv /debugexe "%GENERATOR%" "%-o%"
devenv /debugexe "%GENERATOR%" "%-o%"
) else (
"%GENERATOR%" "%-o%"
"%GENERATOR%" "%-o%"
)

echo Model build complete
2 changes: 1 addition & 1 deletion doxygen/00_MainPage.dox
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ GeNN is a software package to enable neuronal network simulations on
NVIDIA GPUs by code generation. Models are defined in a simple C-style
API and the code for running them on either GPU or CPU hardware is
generated by GeNN. GeNN can also be used through external
interfaces. Currently there are interfaces for \ref SpineML and for [Brian](http://brian2.readthedocs.io) via \ref brian2genn "Brian2GeNN".
interfaces. Currently there are interfaces for \ref SpineML, a \ref PyGeNN and a [Brian](http://brian2.readthedocs.io) interface via \ref brian2genn "Brian2GeNN".

GeNN is currently developed and maintained by

Expand Down
5 changes: 2 additions & 3 deletions doxygen/06_Brian2GeNN.dox
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//----------------------------------------------------------------------------
/*! \page brian2genn Brian interface (Brian2GeNN)

GeNN can simulate models written for the [Brian simulator](http://brian2.readthedocs.io) via the [Brian2GeNN](http://brian2genn.readthedocs.io) interface \cite brian2genn2018 .
The easiest way to install everything needed is to install the [Anaconda](https://www.anaconda.com/download) or [Miniconda](https://conda.io/miniconda.html) Python distribution and then follow the [instructions to install Brian2GeNN](http://brian2genn.readthedocs.io/en/latest/introduction/index.html#installing-the-brian2genn-interface) with the conda package manager.
When Brian2GeNN is installed in this way, it comes with a bundled version of GeNN and no further configuration is required. In all other cases (e.g. an installation from source), the path to GeNN and the CUDA libraries has to be configured via the `GENN_PATH` and `CUDA_PATH` environment variables as described in \ref Installation or via the `devices.genn.path` and `devices.genn.cuda_path` [Brian preferences](http://brian2.readthedocs.io/en/stable/advanced/preferences.html).
GeNN can simulate models written for the [Brian simulator](http://brian2.readthedocs.io) via the [Brian2GeNN](http://brian2genn.readthedocs.io) interface \cite brian2genn2018.
In order for Brian2GeNN to find GeNN, GeNN must either be in your path with the location of the CUDA libraries configured via the `CUDA_PATH` environment variable (as described in \ref Installation) or the `devices.genn.path` and `devices.genn.cuda_backend.cuda_path` [Brian preferences](http://brian2.readthedocs.io/en/stable/advanced/preferences.html) should be set.

To use GeNN to simulate a Brian script, import the `brian2genn` package and switch Brian to the `genn` device.
As an example, the following Python script will simulate Leaky-integrate-and-fire neurons with varying input currents to construct an f/I curve:
Expand Down
35 changes: 35 additions & 0 deletions doxygen/09_ReleaseNotes.dox
Original file line number Diff line number Diff line change
@@ -1,4 +1,39 @@
/*! \page ReleaseNotes Release Notes
Release Notes for GeNN v4.2.1 (PyGeNN 0.3.1)
====
This release fixes several small issues including several relating to Brian2GeNN compatibility.

User Side Changes
----
1. Added -s option to genn-buildmodel.bat on Windows to turn off Visual C++ additional security checks (SDL), allowing Brian2GeNN libraries to be included in code generator.

Bug fixes:
----
1. Fixed bug where \$(sT_pre) and \$(sT_post) were incorrect when accessed in weight update model pre and postsynaptic spike code respectively when using the single-threaded CPU backend.
2. Fixed a corner case where valid models might result in compiler errors about ``Isyn`` not being defined.
3. Fixed a bug preventing multiple include paths being passed to genn-buildmodel.bat on Windows.

Release Notes for GeNN v4.2.0 (PyGeNN 0.3)
====
This release adds a number of new features to GeNN and its Python interface as well as fixing a number of bugs that have been identified since the 4.1.0 release.

User Side Changes
----
1. Kernel timings can now be enabled from python with ``pygenn.genn_model.GeNNModel.timing_enabled`` and subsequently accessed with ``pygenn.genn_model.GeNNModel.neuron_update_time``, ``pygenn.genn_model.GeNNModel.init_time``, ``pygenn.genn_model.GeNNModel.presynaptic_update_time``, ``pygenn.genn_model.GeNNModel.postsynaptic_update_time``, ``pygenn.genn_model.GeNNModel.synapse_dynamics_time`` and ``pygenn.genn_model.GeNNModel.init_sparse_time``.
2. Backends now generate ``getFreeDeviceMemBytes()`` function to allow free device memory to be queried from user simulation code. This is also exposed to Python via ``GeNNModel.free_device_mem_bytes`` property.
3. GeNN preferences are now fully exposed to PyGeNN by passing kwargs to ``pygenn.genn_model.GeNNModel.__init__``.
4. Logging level can now be seperately specified for GeNN, the code generator, the SpineML generator and the backend and is accessible from PyGeNN.
5. ``CodeGenerator::PreferencesBase::enableBitmaskOptimisations`` flag enables an alternative algorithm for updating synaptic matrices implemented with ``SynapseMatrixConnectivity::BITMASK`` which performs better on smaller GPUs and CPUs. If you are manually initialising matrices this adds padding to align words to rows of the matrix.
6. ``SynapseMatrixConnectivity::PROCEDURAL`` and ``SynapseMatrixWeight::PROCEDURAL`` allow connectivity and synaptic weights to be generated on the fly rather than stored in memory.
7. ``CodeGenerator::PreferencesBase::automaticCopy`` flag allows models to be built without the need for explicitly copying data between host and device. For CUDA backend this uses unified memory (https://devblogs.nvidia.com/unified-memory-cuda-beginners/).
8. Speed of code compilation can be improved by building using multiple threads. This is now done everywhere where make or MSBuild is invocated automatically.

Bug fixes:
----
1. Fixed several bugs in extra global parameter implementation in PyGeNN.
2. Floating point min and max should be calculated with ``fmax`` and ``fmin`` in code snippets - fixed in several models and user projects.
3. Fixed issues with version of numpy required in PyGeNN (previously held back by an issue with PyNN)

Release Notes for GeNN v4.1.0
====
This release adds a number of new features to GeNN and its SpineML interface as well as fixing a number of bugs that have been identified since the 4.0.2 release.
Expand Down
37 changes: 29 additions & 8 deletions generate_swig_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,9 @@ def generateBackend(swigPath, folder, namespace):
# Add plog severity header so logging severities can be passed to backend
mg.addSwigInclude('<plog/Severity.h>')

# Parse backend base, ignore BackendBase itself to get PreferencesBase definition
# Parse backend base, ignore BackendBase itself and MemAlloc to get PreferencesBase definition
mg.addSwigIgnore("BackendBase")
mg.addSwigIgnore("MemAlloc")
mg.addSwigInclude('"code_generator/backendBase.h"')

# Parse backend, ignore Backend itself to get PreferencesBase definition
Expand Down Expand Up @@ -500,18 +501,27 @@ def generateConfigs(gennPath, backends):
for header in (NEURONMODELS, POSTSYNMODELS,
WUPDATEMODELS, CURRSOURCEMODELS, INITVARSNIPPET, SPARSEINITSNIPPET):
pygennSmg.addCppInclude( '"' + header + 'Custom.h"' )
pygennSmg.addCppInclude( '"code_generator/backendBase.h"' )
pygennSmg.addCppInclude( '"code_generator/generateAll.h"' )
pygennSmg.addCppInclude( '"code_generator/generateMakefile.h"' )
pygennSmg.addCppInclude( '"code_generator/generateMSBuild.h"' )
pygennSmg.addCppInclude( '"path.h"' )
pygennSmg.addSwigImport( '"StlContainers.i"' )

# Enable C++ camelCase to python underscore_case conversion
pygennSmg.addSwigEnableUnderCaseConvert()

# Include genn export header so GENN_EXPORT macros can be correctly parsed
pygennSmg.addSwigInclude( '"gennExport.h"' )

# Add plog severity header so logging severities can be passed to backend
pygennSmg.addSwigInclude('<plog/Severity.h>')

# Add backend base header but ignore everything apart from MemAlloc
pygennSmg.addSwigIgnore("BackendBase")
pygennSmg.addSwigIgnore("PreferencesBase")
pygennSmg.addSwigInclude('"code_generator/backendBase.h"')

# define and wrap three functions which replace main in generateALL.cc
with SwigInlineScope( pygennSmg ):
pygennSmg.write( '''
Expand All @@ -521,22 +531,23 @@ def generateConfigs(gennPath, backends):
Logging::init(gennLevel, codeGeneratorLevel, consoleAppender, consoleAppender);
}
void generate_code(ModelSpecInternal &model, CodeGenerator::BackendBase &backend, const std::string &path, int localHostID)
CodeGenerator::MemAlloc generate_code(ModelSpecInternal &model, CodeGenerator::BackendBase &backend, const std::string &path, int localHostID)
{
const filesystem::path outputPath(path);
// Generate code, returning list of module names that must be build
const auto moduleNames = CodeGenerator::generateAll(model, backend, outputPath);
const auto output = CodeGenerator::generateAll(model, backend, outputPath);
#ifdef _WIN32
// Create MSBuild project to compile and link all generated modules
std::ofstream makefile((outputPath / "runner.vcxproj").str());
CodeGenerator::generateMSBuild(makefile, backend, "", moduleNames);
CodeGenerator::generateMSBuild(makefile, backend, "", output.first);
#else
// Create makefile to compile and link all generated modules
std::ofstream makefile((outputPath / "Makefile").str());
CodeGenerator::generateMakefile(makefile, backend, moduleNames);
CodeGenerator::generateMakefile(makefile, backend, output.first);
#endif
return output.second;
}
''' )

Expand Down Expand Up @@ -621,8 +632,6 @@ def generateConfigs(gennPath, backends):
%}''')

# wrap NeuronGroup, SynapseGroup and CurrentSource
pygennSmg.addSwigEnableUnderCaseConvert()

pygennSmg.addSwigInclude( '"neuronGroup.h"' )
pygennSmg.addSwigInclude( '"synapseGroup.h"' )
pygennSmg.addSwigInclude( '"currentSource.h"' )
Expand Down Expand Up @@ -669,7 +678,19 @@ def generateConfigs(gennPath, backends):
'ModelSpec::addSynapsePopulation<WeightUpdateModels::{0}, PostsynapticModels::{1}>'.format(
wu_model, ps_model),
'add_synapse_population_{}_{}'.format(wu_model, ps_model))


# Loop through all postsynaptic models
for ps_model in mgs[1].models:
#SynapseGroup *addSlaveSynapsePopulation(const std::string &name, const std::string &weightSharingMasterName, unsigned int delaySteps, const std::string &src, const std::string &trg,
#const typename PostsynapticModel::ParamValues &postsynapticParamValues, const typename PostsynapticModel::VarValues &postsynapticVarInitialisers)
# Ignore the overload of the functions which automatically get instance from class name
pygennSmg.addSwigIgnore("ModelSpec::addSlaveSynapsePopulation<PostsynapticModels::{0}>(std::string const &, std::string const &,unsigned int,std::string const &,std::string const &,PostsynapticModels::{0}::ParamValues const &,PostsynapticModels::{0}::VarValues const &)".format(ps_model))

# Add template expansion
pygennSmg.addSwigTemplate(
'ModelSpec::addSlaveSynapsePopulation<PostsynapticModels::{0}>'.format(ps_model),
'add_slave_synapse_population_{}'.format(ps_model))

for cs_model in mgs[3].models:
# Ignore the overload of the function which automatically gets instance from class name
pygennSmg.addSwigIgnore("ModelSpec::addCurrentSource<CurrentSourceModels::{0}>(std::string const &,std::string const &,CurrentSourceModels::{0}::ParamValues const &,CurrentSourceModels::{0}::VarValues const &)".format(cs_model))
Expand Down
Loading

0 comments on commit 28e923f

Please sign in to comment.