Skip to content

Instantly share code, notes, and snippets.

View PhilipVinc's full-sized avatar
🎯
Solving problems...

Filippo Vicentini PhilipVinc

🎯
Solving problems...
View GitHub Profile
@PhilipVinc
PhilipVinc / prova.py
Last active August 23, 2021 15:43
prova.py
import netket as nk
import jax
from jax.flatten_util import ravel_pytree
import numpy as np
import netket.nn as nknn
import sys
np.set_printoptions(edgeitems=30, linewidth=317, formatter=dict(float=lambda x: "%.3g" % x))
hi =nk.hilbert.Spin(0.5, 4)
# This file is machine-generated - editing it directly is not advised
[[AbstractFFTs]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "485ee0867925449198280d4af84bdb46a2a404d0"
uuid = "621f4979-c628-5d54-868e-fcf4e3e8185c"
version = "1.0.1"
[[AbstractTrees]]
git-tree-sha1 = "03e0550477d86222521d254b741d470ba17ea0b5"
from flax import struct
import netket as nk
from netket.sampler.metropolis import MetropolisSampler
from netket.operator import AbstractOperator
from netket.jax import njit4jax
from netket.sampler.metropolis import MetropolisRule
from numba import jit
```
➜ python -i Examples/Ising1d/ising1d.py
0%| | 0/30 [00:00<?, ?it/s]jambax: numba_fun_8774198495278
encoding jambax gpu
With N_in=2 and n_out=2
Fatal Python error: PyEval_SaveThread: NULL tstate
Python runtime state: initialized
Thread 0x00007fa82cbe9640 (most recent call first):
File "/usr/lib64/python3.8/threading.py", line 306 in wait
import netket as nk
import numpy as np
import json
L = 24
g = nk.graph.Hypercube(length=L, n_dim=1, pbc=True)
hi = nk.hilbert.Spin(s=0.5, N=L)
ha = nk.operator.Ising(hilbert=hi, graph = g, h=0.9)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Using Pkg
Pkg.add("ProtoBuf")
Pkg.add("Glob")
Pkg.add("FilePaths")
using ProtoBuf
using Glob
using FilePaths; using FilePathsBase: /
pbpath =dirname(dirname(PosixPath(pathof(ProtoBuf))))/"gen"
import numpy as _np
import ctypes
from mpi4py import MPI as _MPI
from jax import core
from jax import abstract_arrays
from jax.lib import xla_client
from jax.interpreters import xla
@PhilipVinc
PhilipVinc / mypkg_cython___init__.py
Last active June 23, 2020 19:28
jax and mpi. Interpret underscores in file names as slashes (subpaths)
from . import mpi_xla_bridge
from jax.lib import xla_client
for name, fn in mpi_xla_bridge.cpu_custom_call_targets.items():
xla_client.register_cpu_custom_call_target(name, fn)
{"Output": [{"Sx": {"Mean": 0.9999999169282001, "Variance": 1.862586944649667e-07, "Sigma": 1.1098962439738887e-05, "R_hat": 0.9976736497590734, "TauCorr": 0.0}, "Sy": {"Mean": 5.077493691027381e-05, "Variance": 0.10370042335148308, "Sigma": 0.008281602265203468, "R_hat": 1.003089244834029, "TauCorr": 0.0}, "Sz": {"Mean": -0.0048941798941798936, "Variance": 0.10370620573332213, "Sigma": 0.00828183315490214, "R_hat": 1.0031086816827015, "TauCorr": 0.0}, "LdagL": {"Mean": 17.14925977446276, "Variance": 223.72984547380884, "Sigma": 0.2521810040464449, "R_hat": 1.0002016738591837, "TauCorr": 0.06963744988539322}, "Iteration": 0}, {"Sx": {"Mean": 0.8883244213563494, "Variance": 0.0073810615431987, "Sigma": 0.002209446641081766, "R_hat": 1.0020263155675062, "TauCorr": 0.0}, "Sy": {"Mean": 0.032671567827953656, "Variance": 0.08862480162138474, "Sigma": 0.0076559967859600175, "R_hat": 1.001262256781352, "TauCorr": 0.0}, "Sz": {"Mean": -0.1997354497354497, "Variance": 0.09846553847876598, "Sigma": 0.008069864350415346