Download engine/tests/syn_test.c from amogaddy/neuronal: direct link, hf CLI and curl.
- Browser
- Download file 1.28 kB
-
https://huggingface.co/spaces/amogaddy/neuronal/resolve/main/engine/tests/syn_test.c
- Command line
-
hf download hf://spaces/amogaddy/neuronal/engine/tests/syn_test.c
-
curl -L -o syn_test.c https://huggingface.co/spaces/amogaddy/neuronal/resolve/main/engine/tests/syn_test.c
1.28 kB
| // Misura le sinapsi reali di alcuni neuroni e il costo del calcolo. | |
| static double now(void) { struct timespec t; timespec_get(&t, TIME_UTC); return t.tv_sec + t.tv_nsec * 1e-9; } | |
| int main(void) { | |
| double t0 = now(); | |
| Synapses *s = syn_open("neuronal.gguf", 64, 17408, 5120); | |
| if (!s) return 1; | |
| printf("apertura: %.2fs\n", now() - t0); | |
| SynLink out[8], in[8]; int no, ni; | |
| t0 = now(); | |
| syn_neuron(s, 40, 5370, 8, out, &no, in, &ni); | |
| printf("sinapsi complete del neurone (40, 5370): %.2fs\n", now() - t0); | |
| printf(" uscita ->"); for (int i = 0; i < no; i++) printf(" (%d,%d %+.3f)", out[i].layer, out[i].idx, out[i].w); printf("\n"); | |
| printf(" ingresso <-"); for (int i = 0; i < ni; i++) printf(" (%d,%d %+.3f)", in[i].layer, in[i].idx, in[i].w); printf("\n"); | |
| t0 = now(); | |
| float w = syn_pair(s, 40, 5370, out[0].idx); | |
| double first = now() - t0; t0 = now(); | |
| for (int r = 0; r < 1000; r++) w = syn_pair(s, 40, 5370, out[r % no].idx); | |
| printf("syn_pair: prima %.1f ms, poi %.1f us (in cache); ricalcolo del legame piu' forte: %+.3f\n", | |
| first * 1e3, (now() - t0) * 1e3, syn_pair(s, 40, 5370, out[0].idx)); | |
| syn_close(s); | |
| return 0; | |
| } | |