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
# zhangqiaorjc@google.com
# `jax.distributed.initialize` is available in jax-0.2.25.
# $ pip install --upgrade "jax[cuda]" -f https://storage.googleapis.com/jax-releases/jax_releases.html # Note: wheels only available on linux.
# Run this script on 2 GPU nodes, assuming 10.128.0.6 is the master node
# python nvidia_gpu_pjit.py --server_addr="10.128.0.6:1456" --num_hosts=2 --host_idx=0
# python nvidia_gpu_pjit.py --server_addr="10.128.0.6:1456" --num_hosts=2 --host_idx=1
from absl import app
from absl import flags
@mattjj
mattjj / jax_taylor.py
Last active September 30, 2021 11:58
from functools import partial
from math import factorial
import jax.numpy as np
import matplotlib.pyplot as plt
from jax import jvp, vmap
def f(x):
return 1./5 * x**3 + 3 * x**2 - x + 1.
@llllllllll
llllllllll / constexpr_dict.h
Last active April 15, 2024 13:53
compile-time hashtable for C++17 which supports mixed dtype keys and values
#include <array>
#include <tuple>
#include <type_traits>
#include <utility>
namespace cdict {
template<char... cs>
using string = std::integer_sequence<char, cs...>;
@application2000
application2000 / how-to-install-latest-gcc-on-ubuntu-lts.txt
Last active February 21, 2024 03:02
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@mtao
mtao / eigen_boost_serialization.hpp
Last active March 15, 2024 02:49
Boost serialization for Eigen Matrix and SparseMatrix structures (plus triplets as a helper in SparseMatrix)
/*
Copyright (c) 2015 Michael Tao
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: