Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Moreau tomMoral

View GitHub Profile
@tomMoral
tomMoral / marcenko_pastur.py
Created Jan 19, 2021
Simulate Marcenko-Pastur Law
View marcenko_pastur.py
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
# activate latex text rendering
rc('text', usetex=True)
if __name__ == "__main__":
View child_barriers.cpp
#include <mpi.h>
#include <iostream>
using namespace MPI;
using namespace std;
int main(int argc, char**argv) {
//Initiate the MPI API
@tomMoral
tomMoral / deadlock_unpickle_results.py
Last active Oct 5, 2017
Deadlocks with concurrent.futuress.ProcessPoolExecutor and unpicklable objects
View deadlock_unpickle_results.py
"""
This example highlights the fact that the ProcessPoolExecutor implementation
from concurrent.futures is not robust to unpickling error for the result
(at least in versions 3.6 and lower).
"""
from pickle import UnpicklingError
from concurrent.futures import ProcessPoolExecutor
def return_instance(cls):
View output.txt
$ python -c "if 1:
import numpy as np
from sklearn.manifold.t_sne import TSNE, trustworthiness
from sklearn.utils import check_random_state
random_state = check_random_state(0)
X = random_state.randn(50, 2).astype(np.float32)
n_iter = 250
tsne = TSNE(n_components=2, init='pca', random_state=0,
method='barnes_hut', verbose=20, n_iter=n_iter)
@tomMoral
tomMoral / basic_func.py
Last active Sep 21, 2020
Add a coverage logger thread to get access to coverage in real time
View basic_func.py
from time import sleep
def func0():
print("run func0")
sleep(1)
print("ran func0")
def func1():
@tomMoral
tomMoral / mgr_test.py
Created Oct 17, 2016
Test file for multiprocessing Manager list
View mgr_test.py
import multiprocessing as mp
from multiprocessing import Manager
def test(idx, list_out):
list_out.append(idx)
if __name__ == '__main__':
mgr = Manager()