This file contains 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
import multiprocessing as mp | |
from multiprocessing import Manager | |
def test(idx, list_out): | |
list_out.append(idx) | |
if __name__ == '__main__': | |
mgr = Manager() |
This file contains 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
from time import sleep | |
def func0(): | |
print("run func0") | |
sleep(1) | |
print("ran func0") | |
def func1(): |
This file contains 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
$ 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) |
This file contains 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
""" | |
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): |
This file contains 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
#include <mpi.h> | |
#include <iostream> | |
using namespace MPI; | |
using namespace std; | |
int main(int argc, char**argv) { | |
//Initiate the MPI API |
This file contains 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
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib import rc | |
# activate latex text rendering | |
rc('text', usetex=True) | |
if __name__ == "__main__": |
This file contains 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
#!/bin/bash | |
install_conda(){ | |
_USAGE="Usage | |
===== | |
./install_conda.sh <--gpu> <--prefix|-p DIR> | |
Install conda with miniforge on the system. |