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
cudaError_t Core(int peer_ = 0) | |
{ | |
// -- | |
// Alias variables | |
auto &data_slice = this -> enactor -> | |
problem -> data_slices[this -> gpu_num][0]; | |
auto &enactor_slice = this -> enactor -> | |
enactor_slices[this -> gpu_num * this -> enactor -> num_gpus + peer_]; |
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
// raw CUDA implementation of | |
// ```python | |
// x = np.random.uniform((0, 1), (1000, 10)) | |
// col_max = x.max(axis=0, keepdims=True) | |
// x = x - col_max | |
// x = exp(x) | |
// exp_col_sum = x.sum(axis=0, keepdims=True) | |
// x = log(x) - exp_col_sum | |
// ``` |
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
// CUDA CUB implementation of | |
// ```python | |
// x = np.random.uniform((0, 1), (1000, 10)) | |
// x -= x.max(axis=0, keepdims=True) # subtract max element column-wise | |
// x = np.exp(x) # exponentiate all values | |
// x /= x.sum(axis=0, keepdims=True) # divide by column sums | |
// ``` | |
__global__ void __transpose(double *d_xt, double *d_x, int num_rows, int num_cols) { | |
int offset = threadIdx.x + blockDim.x * blockIdx.x; |
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
#!/usr/bin/env python | |
""" | |
snap_scan_statistics.py | |
""" | |
from __future__ import division, print_function | |
import sys | |
import snap |
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
#!/bin/bash | |
# sdh-init.sh | |
# -- | |
# Set current repo name (on github) and target repo name (on gitlab.sdh.cloud) | |
REPO_NAME="bhtsne" | |
REPO_URL="https://github.com/lvdmaaten/bhtsne" | |
TARGET_NAME="bhtsne" |
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
#!/bin/bash | |
cleanup() { | |
echo "cleanup"; | |
local pids=$(jobs -pr); | |
[ -n "$pids" ] && kill $pids; | |
}; | |
trap "cleanup" INT QUIT TERM EXIT | |
# Put this at the beginning of a file to kill children |
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
#!/usr/bin/env python | |
""" | |
pca_svd.py | |
""" | |
from sklearn.decomposition import TruncatedSVD, PCA | |
import numpy as np | |
X = np.random.normal(0, 1, (100, 10)) | |
X -= X.mean(axis=0) |
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
#!/bin/bash | |
cat urls | shuf > tmp | |
cat tmp | paste - tmp | sed 's@\thttp://@\n\tout=dest/@' > aria-urls | |
cat aria-urls | aria2c -j8 --deferred-input --auto-file-renaming=false -i - |
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
#!/usr/bin/env python | |
""" | |
quiet-logs.py | |
Supress annoying warning messages in `pyspark` | |
""" | |
def quiet_logs(sc): | |
logger = sc._jvm.org.apache.log4j |
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
#!/usr/bin/env python | |
""" | |
eval.py | |
""" | |
from __future__ import print_function, division | |
import sys | |
import argparse |