Skip to content

Instantly share code, notes, and snippets.

View yzchen's full-sized avatar
🏠
Working from home

yzchenmonkey yzchen

🏠
Working from home
  • HeFei, Anhui, China
View GitHub Profile
@yzchen
yzchen / resnet-50D.prototxt
Created April 3, 2019 12:15
Caffe Resnet-50 type D network definition
name: "ResNet-50D"
layer {
name: "data"
type: "Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {

GDB for Caffe

  1. add -g in Makefile
COMMON_FLAGS += -std=c++11

COMMON_FLAGS += -std=c++11 -g
@yzchen
yzchen / caffe-prerequirements.sh
Last active May 6, 2019 11:41
Compile Caffe on HPC System without Root Access
#!/bin/bash
module use -a /project/k1341/.usr/local/share/modulefiles
module load common
# clear previous build
LOCALROOT=/project/k1341/.usr/local
rm -rf $LOCALROOT/bin $LOCALROOT/lib $LOCALROOT/lib64 $LOCALROOT/include $LOCALROOT/share/OpenCV $LOCALROOT/doc $LOCALROOT/man
# protobuf
@yzchen
yzchen / hdf5-env.sh
Last active February 22, 2019 12:11
Problems with hdf5 on Shaheen
module swap PrgEnv-cray PrgEnv-intel
module load hdf5/1.8.21
wget https://support.hdfgroup.org/ftp/HDF5/current/src/unpacked/examples/h5_crtdat.c
gcc h5_crtdat.c
##################################################################
#
#h5_crtdat.c:19:18: fatal error: hdf5.h: No such file or directory
# #include "hdf5.h"
@yzchen
yzchen / profile-disk-speed.sh
Created February 19, 2019 09:34
profile hard disk performance
time sh -c "dd if=/dev/zero of=/disk/path bs=64k count=125000 && sync"
@yzchen
yzchen / colorful-print-in-bash.sh
Created February 19, 2019 09:32
print things with color
# Black 0;30 Dark Gray 1;30
# Red 0;31 Light Red 1;31
# Green 0;32 Light Green 1;32
# Brown/Orange 0;33 Yellow 1;33
# Blue 0;34 Light Blue 1;34
# Purple 0;35 Light Purple 1;35
# Cyan 0;36 Light Cyan 1;36
# Light Gray 0;37 White 1;37
RED='\033[0;31m'
@yzchen
yzchen / file-server.go
Created January 9, 2019 20:01
open a file server with golang
package main
import (
"fmt"
"net/http"
)
const PORT = "7777"
func main() {
fmt.Println("Start listening on port " + PORT)
@yzchen
yzchen / test-read.c
Last active April 28, 2019 18:29
benchmark c read functions
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#define BUFFER_SIZE (1 * 1024 * 1024)
#define ITERATIONS (10 * 1024)
@yzchen
yzchen / test-qsort.c
Created January 9, 2019 19:55
qsort on struct, using one field as pivot to compare
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int a, b, c;
}Int3;
int comp (const void * elem1, const void * elem2) {
Int3 f = *((Int3*)elem1);
Int3 s = *((Int3*)elem2);
@yzchen
yzchen / vector-merge.cc
Last active January 9, 2019 19:51
merge 2-d arrays(store them as 1-d vector, because it's easy to serialize)
#include <iostream>
#include <vector>
using namespace std;
#define IndexType int
void merge_local_vectors(vector<IndexType> &first, vector<IndexType> &second, int pair_size1, int pair_size2, int key1, int key2) {
int ssz1 = first.size(), ssz2 = second.size();
int i = 0, j = 0;