mcdougallab / matlabneuroninterface

Interface for connecting NEURON and MATLAB
BSD 3-Clause "New" or "Revised" License
5 stars 1 forks source link

Add linux, and preliminary mac, support #72

Closed AljenU closed 1 year ago

AljenU commented 1 year ago

Update the code with switches, where necessary, to support windows and mac and linux.

Mainly in setup and buildinterface, and some cpp header files, different paths need to be followed for different operating systems.

Closes #17 Nearly all of #18, except for one last step that is blocking correct execution on mac.

AljenU commented 1 year ago

@edovanveen Please do check that this branch works correctly, including build_interface, on Windows.

edovanveen commented 1 year ago

@edovanveen Please do check that this branch works correctly, including build_interface, on Windows.

I reran build_interface, and runtests +tests runs without failed tests.

I do get some new warnings during the build process that I did not get before, but those can be safely ignored:

>> utils.build_interface
Warning: Some C++ language constructs in the files for generating interface file are not supported and not imported.

Did not add member 'dparam' to class 'Prop' at neuron_api_headers.h:295.
  'Datum *' is not a supported type.

Did not add member 'u' to class 'Object' at neuron_api_headers.h:142.
  'Object::#unnamed#' is not a supported type.

Did not add member 'u' to class 'Symbol' at neuron_api_headers.h:100.
  'Symbol::#unnamed#' is not a supported type.

Did not add member 'element' to class 'hoc_Item' at neuron_api_headers.h:35.
  'hoc_Item::#unnamed#' is not a supported type.

Did not add member 'observers' to class 'cTemplate' at neuron_api_headers.h:119.
  'void *' is not a supported type.

Did not add member 'constructor' to class 'cTemplate' at neuron_api_headers.h:120.
  'void *(*)(Object *)' as data member or return type not supported.

Did not add member 'destructor' to class 'cTemplate' at neuron_api_headers.h:121.
  'void(*)(void *)' as data member or return type not supported.

Did not add member 'steer' to class 'cTemplate' at neuron_api_headers.h:122.
  'void(*)(void *)' as data member or return type not supported.

Did not add member 'checkpoint' to class 'cTemplate' at neuron_api_headers.h:123.
  'int(*)(void * *)' as data member or return type not supported.

Did not add member 'aliases' to class 'Object' at neuron_api_headers.h:144.
  'void *' is not a supported type.

Did not add member 'observers' to class 'Object' at neuron_api_headers.h:148.
  'void *' is not a supported type.

Did not add member '_nt' to class 'Node' at neuron_api_headers.h:268.
  'void *' is not a supported type.

Did not add member 'pnode' to class 'Section' at neuron_api_headers.h:228.
  'Node * *' is not a supported type.

Did not add member 'volatile_ptr' to class 'Section' at neuron_api_headers.h:232.
  'void *' is not a supported type.

C++ compiler set to 'MinGW64 Compiler (C++)'.
Definition file defineneuron.m contains definitions for 183 constructs supported by MATLAB.
- 167 construct(s) are fully defined.
- 16 construct(s) partially defined and commented out.

To include the 16 undefined construct(s) in the interface, uncomment and complete the definitions in defineneuron.m.
To build the interface, call build(defineneuron).
Building interface file 'neuronInterface.dll' for clib package 'neuron'.
Build Log:
C:\ProgramData\MATLAB\SupportPackages\R2022a\3P.instrset\mingw_w64.instrset\bin\g++ -c -fexceptions -fno-omit-frame-pointer -std=c++11 -O2 -fwrapv -DNDEBUG   -I"Z:\Git\matlabneuron\source" -I"C:\Program Files\MATLAB\R2022b\extern\include"  "Z:\Git\matlabneuron\neuron\neuronInterface.cpp" -o "Z:\Git\matlabneuron\neuron\neuronInterface.obj"

C:\ProgramData\MATLAB\SupportPackages\R2022a\3P.instrset\mingw_w64.instrset\bin\g++ -c -fexceptions -fno-omit-frame-pointer -std=c++11 -O2 -fwrapv -DNDEBUG    -I"Z:\Git\matlabneuron\source" -I"C:\Program Files\MATLAB\R2022b\extern\include" "Z:\Git\matlabneuron\source\nrnmatlab.cpp"  -o "Z:\Git\matlabneuron\neuron\nrnmatlab.obj"

C:\ProgramData\MATLAB\SupportPackages\R2022a\3P.instrset\mingw_w64.instrset\bin\g++ -m64 -Wl,--no-undefined -shared -static -static "Z:\Git\matlabneuron\neuron\neuronInterface.obj" "Z:\Git\matlabneuron\neuron\nrnmatlab.obj"   "Z:\Git\matlabneuron\source\libnrniv.a" -L"C:\Program Files\MATLAB\R2022b\extern\lib\win64\mingw64" -llibmex -L"C:\Program Files\MATLAB\R2022b\extern\lib\win64\mingw64" -llibMatlabDataArray  -s   -o "Z:\Git\matlabneuron\neuron\neuronInterface.dll" -Wl,--format=binary -Wl,"Z:\Git\matlabneuron\neuron\neuron.zip" -Wl,--format=default 

---
Interface file 'neuronInterface.dll' built in folder 'Z:\Git\matlabneuron\neuron'.

To use the library, add the interface file folder to the MATLAB path.
AljenU commented 1 year ago

@ramcdougal : This branch should now be ok to try out on Linux.

The following tests results differ numerically on Linux from the results on Windows, sometimes quite a bit. Does that also happen for you?

Failure Summary:

 Name                                     Failed  Incomplete  Reason(s)
======================================================================================
 tests.test_simulation/test_acpot           X                 Failed by verification.
--------------------------------------------------------------------------------------
 tests.test_simulation/test_alphasynapse    X                 Failed by verification.
--------------------------------------------------------------------------------------
 tests.test_simulation/test_netcon          X                 Failed by verification.
--------------------------------------------------------------------------------------
 tests.test_simulation/test_temptest        X                 Failed by verification.
ramcdougal commented 1 year ago

I see the same test failures on my Linux machine...