Skip to content

Instantly share code, notes, and snippets.

View guowangy's full-sized avatar

Guo Wangyang guowangy

View GitHub Profile
@guowangy
guowangy / Makefile
Created April 13, 2022 02:17
Benchmark for adaptive pthread_mutex_lock. Count based (each thread has the same amount of works to do).
all:
gcc -O2 -lpthread -lm mutex-bench-count.c -o mutex-bench-count
clean:
rm -rf mutex-bench-count
@guowangy
guowangy / Makefile
Last active April 13, 2022 02:14
Adaptive pthread_mutex benchmark. It can measure different threads and critical sections (length represented by num of pause instruction)
all:
gcc -O2 -lpthread -lm mutex-bench.c -o mutex-bench
clean:
rm -rf mutex-bench
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <zlib.h>
typedef u_int8_t uint8_t;
static size_t deflate_data(uint8_t *out, size_t outlen, const uint8_t *in,
size_t inlen) {
@guowangy
guowangy / xgboost_iris_prediction.py
Last active February 12, 2020 07:07 — forked from IevaZarina/xgboost_iris_prediction.py
Simple demo script for running Xgboost
# Ieva Zarina, 2016, licensed under the Apache 2.0 licnese
import numpy as np
import xgboost as xgb
import joblib
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.datasets import dump_svmlight_file
from sklearn.metrics import precision_score