c-xy17 / NeuralModeling

for 神经计算建模实战
47 stars 10 forks source link

运行突触仿真模型--电压跳变模型时,出现错误(按照提示安装了pip install taichi==1.7.0) #16

Open HaiYandada opened 6 months ago

HaiYandada commented 6 months ago

Predict 2000 steps: : 0%| | 0/2000 [00:00<?, ?it/s]Traceback (most recent call last): File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\math\op_register\taichi_aot_based.py", line 399, in _compile_kernel _build_kernel(source_md5_encode, kernel, ins_dict, outs_dict, platform) File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\math\op_register\taichi_aot_based.py", line 236, in _build_kernel mod.save(kernel_path) File "D:\anaconda\envs\bdp\lib\site-packages\taichi\aot\module.py", line 223, in save self._aot_builder.dump(filepath, "") RuntimeError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "F:\Programme\NeuralModeling-main\NeuralModeling-main\synapse_models\delta.py", line 39, in run_delta_syn(VoltageJump, title='Delta Synapse Model', g_max=2.) File "F:\Programme\NeuralModeling-main\NeuralModeling-main\synapse_models\run_synapse.py", line 45, in run_delta_syn runner.run(run_duration) File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\runners.py", line 512, in run return self.predict(*args, kwargs) File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\runners.py", line 485, in predict outputs, hists = self._predict(indices, inputs, shared_args=shared_args) File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\runners.py", line 539, in _predict outs_and_mons = self._fun_predict(indices, xs, shared_args=shared_args) File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\runners.py", line 662, in _fun_predict return bm.for_loop(self._step_func_predict, File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\math\object_transform\controls.py", line 892, in for_loop dyn_vals, out_vals = transform(operands) File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\math\object_transform\controls.py", line 737, in call return jax.lax.scan(f=fun2scan, File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\math\object_transform\controls.py", line 728, in fun2scan results = body_fun(*x, unroll_kwargs) File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\runners.py", line 628, in _step_func_predict out = self.target(x) File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\dynsys.py", line 421, in call ret = self.update(args, kwargs) File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\dynsys.py", line 370, in _compatible_update return update_fun(*args, kwargs) File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\dynsys.py", line 479, in update node() File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\dynsys.py", line 421, in call ret = self.update(*args, kwargs) File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\dynsys.py", line 370, in _compatible_update return update_fun(*args, *kwargs) File "F:\Programme\NeuralModeling-main\NeuralModeling-main\synapse_models\delta.py", line 31, in update post_sp = bm.pre2post_event_sum(delayed_pre_spike, self.pre2post, self.post.num, self.g_max) File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\math\pre_syn_post.py", line 97, in pre2post_event_sum return event.csrmv(values, indices, idnptr, events, File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\math\event\csr_matvec.py", line 112, in csrmv return raw_csrmv_taichi(data, indices, indptr, events, shape=shape, transpose=transpose)[0] File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\math\event\csr_matvec.py", line 151, in raw_csrmv_taichi return prim(data, File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\math\op_register\base.py", line 143, in call return self.primitive.bind(ins, outs=outs, kwargs) jax._src.source_info_util.JaxStackTraceBeforeTransformation: RuntimeError: Failed to build kernel:

[taichi cpu kernel] @ti.kernel def _event_csr_matvec_transpose_bool_homo_cpu(values: ti.types.ndarray(ndim=1), indices: ti.types.ndarray(ndim=1), indptr: ti.types.ndarray(ndim=1), events: ti.types.ndarray(ndim=1), out: ti.types.ndarray(ndim=1)): value = values[0] ti.loop_config(serialize=True) for row_i in range(indptr.shape[0] - 1): if events[row_i]: for j in range(indptr[row_i], indptr[row_i + 1]): out[indices[j]] += value

The preceding stack trace is the source of the JAX operation that, once transformed by JAX, triggered the following exception.


The above exception was the direct cause of the following exception:

jax.errors.SimplifiedTraceback: For simplicity, JAX has removed its internal frames from the traceback of the following exception. Set JAX_TRACEBACK_FILTERING=off to include these.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "F:\Programme\NeuralModeling-main\NeuralModeling-main\synapse_models\delta.py", line 39, in run_delta_syn(VoltageJump, title='Delta Synapse Model', g_max=2.) File "F:\Programme\NeuralModeling-main\NeuralModeling-main\synapse_models\run_synapse.py", line 45, in run_delta_syn runner.run(run_duration) File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\runners.py", line 512, in run return self.predict(*args, kwargs) File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\runners.py", line 485, in predict outputs, hists = self._predict(indices, inputs, shared_args=shared_args) File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\runners.py", line 539, in _predict outs_and_mons = self._fun_predict(indices, xs, shared_args=shared_args) File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\runners.py", line 662, in _fun_predict return bm.for_loop(self._step_func_predict, File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\math\object_transform\controls.py", line 892, in for_loop dyn_vals, out_vals = transform(operands) File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\math\object_transform\controls.py", line 737, in call return jax.lax.scan(f=fun2scan, File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\math\op_register\taichi_aot_based.py", line 472, in _taichi_mlir_cpu_translation_rule in_out_info = _compile_kernel(c.avals_in, kernel, 'cpu', kwargs) File "D:\anaconda\envs\bdp\lib\site-packages\brainpy_src\math\op_register\taichi_aot_based.py", line 405, in _compile_kernel raise RuntimeError(f'Failed to build kernel:\n\n {codes}') from e RuntimeError: Failed to build kernel:

[taichi cpu kernel] @ti.kernel def _event_csr_matvec_transpose_bool_homo_cpu(values: ti.types.ndarray(ndim=1), indices: ti.types.ndarray(ndim=1), indptr: ti.types.ndarray(ndim=1), events: ti.types.ndarray(ndim=1), out: ti.types.ndarray(ndim=1)): value = values[0] ti.loop_config(serialize=True) for row_i in range(indptr.shape[0] - 1): if events[row_i]: for j in range(indptr[row_i], indptr[row_i + 1]): out[indices[j]] += value

Process finished with exit code 1

chaoming0625 commented 6 months ago

please try to call brainpy.math.clear_taichi_aot_caches() before running the code. Please tell me whether this fixes the error.

HaiYandada commented 6 months ago

The same error message is displayed.

chaoming0625 commented 6 months ago

python 版本是啥?最好是python3.9 - 3.11 。