-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
239 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
*.class | ||
*.csv | ||
*.csv | ||
/CARLsim_version/iz_fp_eval/build_dir | ||
/CARLsim_version/iz_fp_eval/scripts/*.png |
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,32 @@ | ||
project(iz_fp_eval) | ||
|
||
# Targets | ||
add_executable(iz_fp_eval | ||
src/main_iz_fp_eval.cpp | ||
) | ||
|
||
# definitions | ||
if(CARLSIM_NO_CUDA) | ||
target_compile_definitions(iz_fp_eval PUBLIC | ||
-D__NO_CUDA__ ) | ||
endif() | ||
|
||
# Linking | ||
target_link_libraries(iz_fp_eval PRIVATE | ||
carlsim | ||
carlsim-stopwatch | ||
) | ||
target_include_directories(iz_fp_eval PRIVATE | ||
../../tools/stopwatch | ||
) | ||
|
||
|
||
# Installation | ||
install(TARGETS iz_fp_eval | ||
EXPORT carlsim | ||
RUNTIME | ||
DESTINATION $<$<CONFIG:Debug>:debug/>samples | ||
COMPONENT iz_fp_eval | ||
) | ||
|
||
#install(FILES run_iz_fp_eval DESTINATION $<$<CONFIG:Debug>:debug/>samples) |
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 @@ | ||
make clean && make && ./iz_fp_eval 118.000000 0.62 -58.53 -43.52 0.005 8.0 11.48 -49.52 8.5 |
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,37 @@ | ||
% A simple demo of the NetworkMonitor functionality | ||
|
||
% add Offline Analysis Toolbox to path | ||
initOAT; | ||
|
||
% init NetworkMonitor | ||
NM = NetworkMonitor('../results/sim_hello world.dat'); | ||
|
||
% plot network activity | ||
disp('NetworkMonitor.plot') | ||
disp('-------------------') | ||
disp('Press ''p'' to pause.') | ||
disp('Press ''q'' to quit.') | ||
disp(['Press ''s'' to enter stepping mode; then press the ' ... | ||
'right arrow key to step']) | ||
disp('one frame forward, press the left arrow key to step one frame back.') | ||
disp('Press ''s'' again to leave stepping mode.') | ||
disp(' ') | ||
NM.plot; | ||
|
||
|
||
% init ConnectionMonitor | ||
CM = ConnectionMonitor('input','output','../results/'); | ||
|
||
% visualize receptive fields (little 2D Gaussian kernels for each post-neuron) | ||
disp('ConnectionMonitor.plot(''receptivefield'')') | ||
disp('-------------------') | ||
disp('Press ''p'' to pause.') | ||
disp('Press ''q'' to quit.') | ||
disp(['Press ''s'' to enter stepping mode; then press the ' ... | ||
'right arrow key to step']) | ||
disp('one frame forward, press the left arrow key to step one frame back.') | ||
disp('Press ''s'' again to leave stepping mode.') | ||
CM.plot('receptivefield') | ||
|
||
% analogously, the response field of each pre-neuron can be visualized: | ||
% CM.plot('responsefield') |
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,3 @@ | ||
% add path to Offline Analysis Toolbox | ||
%addpath('../../../tools/offline_analysis_toolbox') | ||
addpath('/comp_neuro/Software/CARLsim4_dgx_hc_09_18_21/tools/offline_analysis_toolbox') |
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,18 @@ | ||
% analyze voltage from a neuron using IZ 9-param model | ||
|
||
function []=plot_results(volt_file, output_desc) | ||
initOAT; | ||
save_plot=1; | ||
neur_read = NeuronReader(volt_file); | ||
voltages = neur_read.readValues(); | ||
t_start = 1; % start time | ||
t_end = 1100; % end time | ||
t_range = linspace(t_start,t_end,(t_end-t_start+1)); | ||
selected_volt = voltages.v(1,t_start:t_end); | ||
% plot | ||
plot(t_range, selected_volt,'Color','#80B3FF','LineWidth',1.5); | ||
if save_plot | ||
output_filename = sprintf("voltage_%s.png",output_desc); | ||
exportgraphics(gcf,output_filename,'Resolution',300) | ||
end | ||
end |
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 @@ | ||
plot_results('../build_dir/results/n_neuron.dat', 'test'); |
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 @@ | ||
# Put all source files (.cpp and .cu) here |
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,85 @@ | ||
/* * Copyright (c) 2016 Regents of the University of California. 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. The names of its contributors may not 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 OWNER 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. | ||
* | ||
* *********************************************************************************************** * | ||
* CARLsim | ||
* created by: (MDR) Micah Richert, (JN) Jayram M. Nageswaran | ||
* maintained by: | ||
* (MA) Mike Avery <[email protected]> | ||
* (MB) Michael Beyeler <[email protected]>, | ||
* (KDC) Kristofor Carlson <[email protected]> | ||
* (TSC) Ting-Shuo Chou <[email protected]> | ||
* (HK) Hirak J Kashyap <[email protected]> | ||
* | ||
* CARLsim v1.0: JM, MDR | ||
* CARLsim v2.0/v2.1/v2.2: JM, MDR, MA, MB, KDC | ||
* CARLsim3: MB, KDC, TSC | ||
* CARLsim4: TSC, HK | ||
* CARLsim5: HK, JX, KC | ||
* CARLsim6: LN, JX, KC, KW | ||
* | ||
* CARLsim available from http://socsci.uci.edu/~jkrichma/CARLsim/ | ||
* Ver 12/31/2016 | ||
*/ | ||
|
||
// include CARLsim user interface | ||
#include <carlsim.h> | ||
|
||
int main(int argc, char *argv[]) { | ||
if (argc != 10) { | ||
printf("\nUsage: iz_fp_eval <9_IM_params>\n"); | ||
printf("%d arguments found.\n",argc); | ||
} | ||
else { | ||
// ---------------- CONFIG STATE ------------------- | ||
CARLsim sim("hello world", GPU_MODE, USER, 1, 42); | ||
int dummy = sim.createSpikeGeneratorGroup("dummy_connection", 1, EXCITATORY_NEURON, 0, GPU_CORES); | ||
int neuron=sim.createGroup("neuron", 1, EXCITATORY_NEURON, ANY, GPU_CORES); | ||
sim.setNeuronParameters(neuron, atof(argv[1]), 0.0f, atof(argv[2]), | ||
0.0f, atof(argv[3]), 0.0f, atof(argv[4]), 0.0f, atof(argv[5]), 0.0f, | ||
atof(argv[6]), 0.0f, atof(argv[7]), 0.0f, atof(argv[8]), 0.0f, | ||
atof(argv[9]), 0.0f, 150); | ||
sim.connect(dummy, neuron, "one-to-one", 0.0f, SYN_FIXED); // CARLsim seems to require at least one connection. This is a dummy connection with no signaling to the other neuron. | ||
sim.setNeuronMonitor(neuron,"DEFAULT"); | ||
sim.setIntegrationMethod(RUNGE_KUTTA4, 1);//40); | ||
// ---------------- SETUP STATE ------------------- | ||
sim.setupNetwork(); | ||
SpikeMonitor* spk_mon = sim.setSpikeMonitor(neuron, "DEFAULT"); | ||
// ---------------- RUN STATE ------------------- | ||
spk_mon->startRecording(); | ||
for (int i=0; i<100; i++) { | ||
if (i==1) {sim.setExternalCurrent(neuron, 200.0f);} | ||
if (i==10) {sim.setExternalCurrent(neuron, 0.0f);} | ||
sim.runNetwork(0,100, false); | ||
} | ||
spk_mon->stopRecording(); | ||
} | ||
|
||
return 0; | ||
} |
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,58 @@ | ||
project(carlsim-hello-world) | ||
cmake_minimum_required(VERSION 3.19.4) | ||
|
||
|
||
# Dependencies | ||
|
||
find_package(carlsim REQUIRED) | ||
|
||
# Targets | ||
|
||
add_executable(hello_world | ||
src/main_hello_world.cpp | ||
) | ||
|
||
if(CARLSIM_NO_CUDA) | ||
target_compile_definitions(hello_world | ||
PUBLIC | ||
-D__NO_CUDA__ | ||
) | ||
endif() | ||
|
||
# include | ||
target_include_directories(hello_world PRIVATE | ||
${CARLSIM_INCLUDE_DIR} | ||
) | ||
|
||
# Linking | ||
|
||
target_link_directories(hello_world PRIVATE | ||
${CARLSIM_LIB_DIR} | ||
) | ||
|
||
if(NOT CARLSIM_NO_CUDA) | ||
target_link_directories(hello_world PRIVATE | ||
${CARLSIM_CUDA_LIB_DIR} | ||
) | ||
endif() | ||
|
||
target_link_libraries(hello_world PRIVATE | ||
carlsim$<$<CONFIG:Debug>:d>.lib | ||
carlsim-stopwatch$<$<CONFIG:Debug>:d>.lib | ||
# carlsim-interface | ||
# carlsim-kernel | ||
# carlsim-monitor | ||
# carlsim-simple-weight-tuner | ||
# carlsim-spike-generators | ||
# carlsim-stopwatch | ||
# carlsim-visual-stimulus | ||
) | ||
|
||
if(NOT CARLSIM_NO_CUDA) | ||
target_link_libraries(hello_world PRIVATE | ||
carlsim-kernel-cuda | ||
cudart | ||
curand | ||
) | ||
endif() | ||
|