Skip to content

Instantly share code, notes, and snippets.

View disa-mhembere's full-sized avatar

Disa Mhembere disa-mhembere

View GitHub Profile
@disa-mhembere
disa-mhembere / numa_ops.cpp
Created December 12, 2018 19:35
Code to help with NUMA opts
// Numa allocate
void numa_alloc(double* data) {
data = static_cast<double*>(numa_alloc_onnode(data_size, node_id));
}
// Numa deallocate
void numa_dealloc(double* data, size_t data_size) {
numa_free(data, data_size);
}
@disa-mhembere
disa-mhembere / flashr_eigen_example.R
Created January 4, 2018 19:15
flashr eigen example
require(FlashR)
fgmat <- fm.as.matrix(replicate(100, rnorm(100)))
mul = function(mat, extra) fgmat %*% mat
res <- fm.eigen(mul, 5, nrow(fgmat))
@disa-mhembere
disa-mhembere / Graph.py
Last active September 13, 2017 21:35
D3M graph interface
class Graph(object):
adjacency_matrix = None
_num_vertices = None
_num_edges = None
_directed = None
_weighted = None
_dangling_nodes = None
def __init__(self):
pass
@disa-mhembere
disa-mhembere / Graph.py
Created September 13, 2017 21:26
D3M graph interface
class Graph(object):
self.adjacency_matrix = None
self._num_vertices = None
self._num_edges = None
self._directed = None
self._weighted = None
self._dangling_nodes = None
def __init__(self,):
@disa-mhembere
disa-mhembere / kmeans_intel_daal2.py
Last active April 17, 2017 05:46
Another version of the kmeans intel daal's kmeans
""" A class for K-Means clustering """
"""
Adapted from Zhang Zhang zhang.zhang@intel.com
https://github.com/daaltces/pydaal-tutorials/blob/master/kmeans.py
https://github.com/daaltces/pydaal-tutorials/blob/master/kmeans_example.ipynb
"""
import daal.algorithms.kmeans as kmeans
@disa-mhembere
disa-mhembere / kmeans_intel_daal.py
Last active April 17, 2017 05:30
A serial code composed of 2 examples adapted from intel daal examples
from os import environ
from os.path import join as jp
import numpy as np
from time import time
from sys import argv
from daal.data_management import HomogenNumericTable, BlockDescriptor_Float64, readOnly
from daal.data_management import (
FileDataSource, DataSourceIface
@disa-mhembere
disa-mhembere / checkbox_bug.md
Created April 5, 2017 00:34
A gist to show when checkboxes don't work as expected
  • Experiments
    • Reorder to put the most important result first
  • Verify: I don’t think BLAS GEMM version kmean will be slower than MLpack and Scikit-learn.
@disa-mhembere
disa-mhembere / gameoflife.c
Last active August 29, 2015 14:19
A stub for the game of life
// gameoflife.c
// Name: YOUR NAME HERE
// JHED: YOUR JHED HERE
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include "mpi.h"
@disa-mhembere
disa-mhembere / kmeans.py
Created April 5, 2015 17:09
Spark example implementation of k-means
# This script was wholly obtained from: https://spark-summit.org/2013/exercises/machine-learning-with-spark.html.
# I take no credit/blame for the implementation.
import os
import sys
import numpy as np
from pyspark import SparkContext
def setClassPath():
oldClassPath = os.environ.get('SPARK_CLASSPATH', '')
@disa-mhembere
disa-mhembere / triangle_count.py
Created April 5, 2015 06:02
Stubs for triangle counting assignment
"""
Author: YOUR NAME HERE
JHED: YOUR JHED HERE
Name: triangle_count.py
Get the list of cycle triangles in the graph
"""
from pyspark import SparkContext
from time import time