This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using JuMP, HiGHS, Graphs, LinearAlgebra, Test | |
# Find one valid assignment with integer programming | |
function lattice_sites(num_sites::Vector{Int}, multiplicity::Vector{Int}, num_atoms::Vector{Int}) | |
model = Model(HiGHS.Optimizer) | |
JuMP.set_silent(model) | |
@variable(model, x[1:length(num_sites), 1:length(num_atoms)] >= 0, Int) | |
for (ia, na) in enumerate(num_atoms) | |
@constraint(model, sum(x[i, ia] * num_sites[i] for i in 1:length(num_sites)) == na) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GenericTensorNetworks | |
# create a random King's subgraph | |
graph = random_diagonal_coupled_graph(7, 7, 0.8) | |
# create an independent set problem | |
problem = IndependentSet(graph) | |
# convert to tensor network | |
pb = GenericTensorNetwork(problem) | |
# solve the MIS size |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### A Pluto.jl notebook ### | |
# v0.19.9 | |
using Markdown | |
using InteractiveUtils | |
# ╔═╡ 195eb152-17e7-11ed-32ab-ab200fb170af | |
using Yao, YaoPlots, Polynomials | |
# ╔═╡ f6f10336-205c-4581-9418-de6fdd9b6418 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To run this script, you need to install required packages in a Julia REPL: | |
# ```julia | |
# using Pkg; Pkg.add(["GenericTensorNetworks", "CUDA", "Comonicon", "DelimitedFiles"]) | |
# ``` | |
# | |
# Then open a terminal, go to the file folder and type | |
# ```bash | |
# $ julia fib2d.jl 20 | |
# ``` | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using LinearAlgebra: mul! | |
""" | |
strassen!(C, A, B, s0=8) | |
Compute matrix multiplication `C = A * B` using the strassen algorithm. | |
`s0` is the critical size to stop Strassen recursion, it can be slow if it recurse too deep, | |
then one needs to set this value larger. | |
!!!note |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# requires OMEinsum version >= 0.7 | |
using Distributed | |
using OMEinsum, CUDA | |
println("find $(length(devices())) GPU devices") | |
const procs = addprocs(length(devices())-nprocs()+1) | |
const gpus = collect(devices()) | |
const process_device_map = Dict(zip(procs, gpus)) | |
@info process_device_map |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using TropicalNumbers, VectorizationBase | |
using Test | |
using LoopVectorization, Octavian | |
using VectorizationBase: OffsetPrecalc, StaticBool, Bit, static, NativeTypes, Index, gep_quote, VectorIndex | |
function distance(a::AbstractArray{<:Tropical}, b::AbstractArray{<:Tropical}) | |
sum(abs.(content.(a) .- content.(b))) | |
end | |
LoopVectorization.check_args(::Type{T}, ::Type{T}) where T<:Tropical = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# v0.12.17 | |
using Markdown | |
using InteractiveUtils | |
# ╔═╡ f178d9fe-49f4-11eb-0863-21e2e3934592 | |
using Yao, YaoPlots | |
# ╔═╡ d59b39ec-49f5-11eb-3d4a-fb69f2505d3c | |
using SymEngine |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using CUDA | |
using CUDA.WMMA | |
using CUDA.WMMA: ColMajor, load_a, load_b, load_c, mma, store_d | |
using StaticArrays | |
a = rand(Float16, 16, 16) | |
b = rand(Float16, 16, 16) | |
c = zeros(Float16, 16, 16) | |
d = zeros(Float16, 16, 16) | |
a_dev = CuArray(a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
optimizer: | |
ip: 127.0.0.1 | |
port: 2000 | |
method: spsa | |
initial-params: specified | |
initial-params.random: | |
seed: 2 | |
p: 5 | |
initial-params.specified: | |
- |
NewerOlder