nemo.h

Go to the documentation of this file.
00001 #ifndef NEMO_H
00002 #define NEMO_H
00003 
00004 /* Copyright 2010 Imperial College London
00005  *
00006  * This file is part of NeMo.
00007  *
00008  * This software is licenced for non-commercial academic use under the GNU
00009  * General Public Licence (GPL). You should have received a copy of this
00010  * licence along with NeMo. If not, see <http://www.gnu.org/licenses/>.
00011  */
00012 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034 
00035 
00036 #include <stddef.h> // for size_t
00037 #include <nemo/config.h>
00038 #include <nemo/types.h>
00039 
00040 
00041 
00042 /* Dummy classes */
00043 struct nemo_network_class;
00044 struct nemo_simulation_class;
00045 struct nemo_configuration_class;
00046 
00048 typedef nemo_network_class* nemo_network_t;
00049 typedef nemo_simulation_class* nemo_simulation_t;
00050 typedef nemo_configuration_class* nemo_configuration_t;
00051 
00053 typedef int nemo_status_t;
00054 
00055 
00056 NEMO_DLL_PUBLIC
00057 const char* nemo_version();
00058 
00059 
00060 //-----------------------------------------------------------------------------
00061 // HARDWARE CONFIGURATION
00062 //-----------------------------------------------------------------------------
00063 
00064 
00071 NEMO_DLL_PUBLIC
00072 nemo_status_t
00073 nemo_cuda_device_count(unsigned* count);
00074 
00075 
00076 NEMO_DLL_PUBLIC
00077 nemo_status_t
00078 nemo_cuda_device_description(unsigned device, const char**);
00079 
00080 
00081 //-----------------------------------------------------------------------------
00082 // CONFIGURATION
00083 //-----------------------------------------------------------------------------
00084 
00086 /* \{ */ // begin configuration
00087 
00088 NEMO_DLL_PUBLIC
00089 nemo_configuration_t nemo_new_configuration();
00090 
00091 
00092 NEMO_DLL_PUBLIC
00093 void nemo_delete_configuration(nemo_configuration_t);
00094 
00095 
00097 NEMO_DLL_PUBLIC
00098 nemo_status_t nemo_log_stdout(nemo_configuration_t);
00099 
00131 NEMO_DLL_PUBLIC
00132 nemo_status_t
00133 nemo_set_stdp_function(nemo_configuration_t,
00134         float prefire_fn[], size_t prefire_len,
00135         float postfire_fn[], size_t postfire_len,
00136         float min_excitatory_weight,
00137         float max_excitatory_weight,
00138         float min_inhibitory_weight,
00139         float max_inhibitory_weight);
00140 
00141 
00143 NEMO_DLL_PUBLIC
00144 nemo_status_t
00145 nemo_set_cpu_backend(nemo_configuration_t, int thread_count);
00146 
00147 
00149 NEMO_DLL_PUBLIC
00150 nemo_status_t
00151 nemo_cpu_thread_count(nemo_configuration_t conf, int* thread_count);
00152 
00153 
00155 NEMO_DLL_PUBLIC
00156 nemo_status_t
00157 nemo_set_cuda_backend(nemo_configuration_t conf, int dev);
00158 
00159 
00160 NEMO_DLL_PUBLIC
00161 nemo_status_t
00162 nemo_cuda_device(nemo_configuration_t conf, int* dev);
00163 
00164 
00166 NEMO_DLL_PUBLIC
00167 nemo_status_t
00168 nemo_backend(nemo_configuration_t conf, backend_t* backend);
00169 
00170 
00172 NEMO_DLL_PUBLIC
00173 nemo_status_t
00174 nemo_backend_description(nemo_configuration_t conf, const char** descr);
00175 
00176 
00178 NEMO_DLL_PUBLIC
00179 nemo_status_t
00180 nemo_set_write_only_synapses(nemo_configuration_t conf);
00181 
00182 
00183 
00184 /* \} */ // end configuration
00185 
00186 
00187 
00188 //-----------------------------------------------------------------------------
00189 // NETWORK CONSTRUCTION
00190 //-----------------------------------------------------------------------------
00191 
00204 NEMO_DLL_PUBLIC
00205 nemo_network_t nemo_new_network();
00206 
00207 
00209 NEMO_DLL_PUBLIC
00210 void nemo_delete_network(nemo_network_t);
00211 
00212 
00213 
00224 NEMO_DLL_PUBLIC
00225 nemo_status_t
00226 nemo_add_neuron_type(nemo_network_t,
00227         const char* name,
00228         unsigned* neuron_type);
00229 
00230 
00234 NEMO_DLL_PUBLIC
00235 nemo_status_t
00236 nemo_add_neuron_iz(nemo_network_t,
00237         unsigned idx,
00238         float a, float b, float c, float d,
00239         float u, float v, float sigma);
00240 
00241 
00242 
00254 NEMO_DLL_PUBLIC
00255 nemo_status_t
00256 nemo_add_neuron(nemo_network_t, unsigned type, unsigned idx,
00257         unsigned nargs, float args[]);
00258 
00259 
00260 
00261 /* Add a single synapse to network
00262  *
00263  * \a id
00264  *      Unique id of this synapse (which can be used for run-time queries). Set
00265  *      to NULL if this is not required.
00266  */
00267 NEMO_DLL_PUBLIC
00268 nemo_status_t
00269 nemo_add_synapse(nemo_network_t,
00270         unsigned source,
00271         unsigned target,
00272         unsigned delay,
00273         float weight,
00274         unsigned char is_plastic,
00275         synapse_id* id);
00276 
00277 
00278 
00279 NEMO_DLL_PUBLIC
00280 nemo_status_t
00281 nemo_neuron_count(nemo_network_t net, unsigned* ncount);
00282 
00283 
00284 
00285 
00286 /* \} */ // end construction group
00287 
00288 
00289 
00290 //-----------------------------------------------------------------------------
00291 // SIMULATION
00292 //-----------------------------------------------------------------------------
00293 
00300 NEMO_DLL_PUBLIC
00301 nemo_simulation_t nemo_new_simulation(nemo_network_t, nemo_configuration_t);
00302 
00303 
00305 NEMO_DLL_PUBLIC
00306 void nemo_delete_simulation(nemo_simulation_t);
00307 
00308 
00336 NEMO_DLL_PUBLIC
00337 nemo_status_t
00338 nemo_step(nemo_simulation_t,
00339         unsigned fstim_nidx[], size_t fstim_count,
00340         unsigned istim_nidx[], float istim_current[], size_t istim_count,
00341         unsigned* fired[], size_t* fired_count);
00342 
00343 
00345 NEMO_DLL_PUBLIC
00346 nemo_status_t
00347 nemo_apply_stdp(nemo_simulation_t, float reward);
00348 
00349 
00350 //-----------------------------------------------------------------------------
00351 // QUERIES
00352 //-----------------------------------------------------------------------------
00353 
00369 NEMO_DLL_PUBLIC
00370 nemo_status_t
00371 nemo_get_membrane_potential(nemo_simulation_t sim, unsigned neuron, float* v);
00372 
00373 
00374 
00388 NEMO_DLL_PUBLIC
00389 nemo_status_t
00390 nemo_get_neuron_state_n(nemo_network_t net, unsigned neuron, unsigned var, float* val);
00391 
00392 
00393 
00407 NEMO_DLL_PUBLIC
00408 nemo_status_t
00409 nemo_get_neuron_parameter_n(nemo_network_t net, unsigned neuron, unsigned param, float* val);
00410 
00411 
00412 
00426 NEMO_DLL_PUBLIC
00427 nemo_status_t
00428 nemo_get_neuron_state_s(nemo_simulation_t sim, unsigned neuron, unsigned var, float* val);
00429 
00430 
00431 
00445 NEMO_DLL_PUBLIC
00446 nemo_status_t
00447 nemo_get_neuron_parameter_s(nemo_simulation_t sim, unsigned neuron, unsigned param, float* val);
00448 
00449 
00450 
00456 NEMO_DLL_PUBLIC
00457 nemo_status_t
00458 nemo_get_synapse_source_n(nemo_network_t, synapse_id synapse, unsigned* source);
00459 
00460 
00461 
00467 NEMO_DLL_PUBLIC
00468 nemo_status_t
00469 nemo_get_synapse_source_s(nemo_simulation_t, synapse_id synapse, unsigned* source);
00470 
00471 
00472 
00478 NEMO_DLL_PUBLIC
00479 nemo_status_t
00480 nemo_get_synapse_target_n(nemo_network_t, synapse_id synapse, unsigned* target);
00481 
00482 
00488 NEMO_DLL_PUBLIC
00489 nemo_status_t
00490 nemo_get_synapse_target_s(nemo_simulation_t, synapse_id synapse, unsigned* target);
00491 
00492 
00498 NEMO_DLL_PUBLIC
00499 nemo_status_t
00500 nemo_get_synapse_delay_n(nemo_network_t, synapse_id synapse, unsigned* delay);
00501 
00502 
00508 NEMO_DLL_PUBLIC
00509 nemo_status_t
00510 nemo_get_synapse_delay_s(nemo_simulation_t, synapse_id synapse, unsigned* delay);
00511 
00512 
00518 NEMO_DLL_PUBLIC
00519 nemo_status_t
00520 nemo_get_synapse_weight_n(nemo_network_t, synapse_id synapse, float* weight);
00521 
00522 
00528 NEMO_DLL_PUBLIC
00529 nemo_status_t
00530 nemo_get_synapse_weight_s(nemo_simulation_t, synapse_id synapse, float* weight);
00531 
00532 
00538 NEMO_DLL_PUBLIC
00539 nemo_status_t
00540 nemo_get_synapse_plastic_n(nemo_network_t, synapse_id synapse, unsigned char* plastic);
00541 
00542 
00548 NEMO_DLL_PUBLIC
00549 nemo_status_t
00550 nemo_get_synapse_plastic_s(nemo_simulation_t, synapse_id synapse, unsigned char* plastic);
00551 
00552 
00554 NEMO_DLL_PUBLIC
00555 nemo_status_t
00556 nemo_get_synapses_from_n(nemo_network_t, unsigned source, synapse_id *synapses[], size_t* len);
00557 
00558 
00568 NEMO_DLL_PUBLIC
00569 nemo_status_t
00570 nemo_get_synapses_from_s(nemo_simulation_t, unsigned source, synapse_id *synapses[], size_t* len);
00571 
00572 
00573 
00574 /* \} */ // end simulation group
00575 
00576 
00577 //-----------------------------------------------------------------------------
00578 // MODIFYING THE NETWROK
00579 //-----------------------------------------------------------------------------
00580 
00602 NEMO_DLL_PUBLIC
00603 nemo_status_t
00604 nemo_set_neuron_n(nemo_network_t, unsigned idx, unsigned nargs, float args[]);
00605 
00606 
00616 NEMO_DLL_PUBLIC
00617 nemo_status_t
00618 nemo_set_neuron_s(nemo_simulation_t, unsigned idx, unsigned nargs, float args[]);
00619 
00620 
00628 NEMO_DLL_PUBLIC
00629 nemo_status_t
00630 nemo_set_neuron_iz_n(nemo_network_t net,
00631         unsigned idx,
00632         float a, float b, float c, float d,
00633         float u, float v, float sigma);
00634 
00635 
00643 NEMO_DLL_PUBLIC
00644 nemo_status_t
00645 nemo_set_neuron_iz_s(nemo_simulation_t sim,
00646         unsigned idx,
00647         float a, float b, float c, float d,
00648         float u, float v, float sigma);
00649 
00650 
00664 NEMO_DLL_PUBLIC
00665 nemo_status_t
00666 nemo_set_neuron_state_n(nemo_network_t net, unsigned neuron, unsigned var, float val);
00667 
00668 
00682 NEMO_DLL_PUBLIC
00683 nemo_status_t
00684 nemo_set_neuron_parameter_n(nemo_network_t net, unsigned neuron, unsigned param, float val);
00685 
00686 
00700 NEMO_DLL_PUBLIC
00701 nemo_status_t
00702 nemo_set_neuron_state_s(nemo_simulation_t sim, unsigned neuron, unsigned var, float val);
00703 
00704 
00718 NEMO_DLL_PUBLIC
00719 nemo_status_t
00720 nemo_set_neuron_parameter_s(nemo_simulation_t sim, unsigned neuron, unsigned param, float val);
00721 
00722 
00723 /* \} */ // end modification group
00724 
00725 
00726 //-----------------------------------------------------------------------------
00727 // TIMERS
00728 //-----------------------------------------------------------------------------
00729 
00730 
00739 
00740 
00742 NEMO_DLL_PUBLIC
00743 nemo_status_t nemo_elapsed_wallclock(nemo_simulation_t, unsigned long*);
00744 
00746 NEMO_DLL_PUBLIC
00747 nemo_status_t nemo_elapsed_simulation(nemo_simulation_t, unsigned long*);
00748 
00750 NEMO_DLL_PUBLIC
00751 nemo_status_t nemo_reset_timer(nemo_simulation_t);
00752 
00753 /* \} */ // end timing section
00754 
00755 
00756 
00757 
00758 //-----------------------------------------------------------------------------
00759 // ERROR HANDLING
00760 //-----------------------------------------------------------------------------
00761 
00770 
00771 
00775 NEMO_DLL_PUBLIC
00776 const char* nemo_strerror();
00777   //end error group
00779 
00780 
00781 
00782 
00783 #ifdef __cplusplus
00784 }
00785 #endif
00786 
00787 #endif
Generated on Mon Aug 15 11:38:39 2011 for NeMo by  doxygen 1.6.3