include("Hamiltonian.jl") GPU_mode = !("CPU" in ARGS) && CUDA.functional() && CUDA.has_cuda() && CUDA.has_cuda_gpu() println("Running with ",Threads.nthreads()," thread(s)") if GPU_mode mode=gpu_cutensor println("Available GPUs:") print(" ") println.(name.(devices())) else mode=cpu_tensor end T=Float32 function V_test(r2) return -4*exp(-r2/4) end function apply1000times(H,v) for i in 1:1000 v=H(v); end end N=10 n_image=1 μ=0.5 for L in 5.0:14.0 println("Constructing H operator...") s=system{T}(3,3,N,L,μ) @time H=Hamiltonian{T}(s,V_test,0,n_image,mode) println("Applying H 1000 times...") if GPU_mode v=CUDA.rand(Complex{T},vectorDims(H)...) synchronize() CUDA.@profile CUDA.@time apply1000times(H,v) else v=rand(Complex{T},vectorDims(H)...) @time apply1000times(H,v) end end