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
# Dependency generation | |
# Project must define SRCS | |
DEPS = $(addprefix deps/,$(SRCS:.c=.d)) | |
deps/%.d: %.c | |
$(CC) -MM $(CFLAGS) $(CPPFLAGS) -o $@ $< | |
sed -i "s/\($*.o\)/\1 deps\/$(notdir $@)/g" $@ | |
# Prevent make from generating dependencies when running 'make clean' |
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
# Rule generation | |
# Project must define PROGS, SRCS, and *_SRCS to specify targets and prerequisites | |
OBJS = $(SRCS:.c=.o) | |
define RULE_template | |
$(1): $$($(subst -,_,$(1))_SRCS:.c=.o) $$($(subst -,_,$(1))_PREREQS) | |
$$(CC) -o $$@ $$(filter %.o,$$^) $$(LDFLAGS) $$(IMPORTS) $$($(subst -,_,$(1))_LIBS:%=-l%) | |
endef |
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 | |
usage="Usage: $(basename "$0") <name>" | |
if [ $# -ne 1 ]; then | |
echo $usage | |
exit 0 | |
fi | |
proj=$1 |
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 "channel.h" | |
// Example use: | |
// channel_range(chan, &val) { | |
// do sth with val | |
// } | |
#define unique_name_paste(id, n) id ##_## n | |
#define unique_name(id, n) unique_name_paste(id, n) |
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
#ifndef _GNU_SOURCE | |
#define _GNU_SOURCE | |
#endif | |
#include <pthread.h> | |
#include <sched.h> | |
#include "overload_set_thread_affinity.h" | |
static inline void set_thread_affinity(pthread_t t, int cpu) |
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 | |
# Calculate the standard deviation of a series of numbers | |
cat > stddev.io <<IOCODE | |
#!/usr/bin/env io | |
l := List clone | |
IOCODE | |
chmod +x stddev.io |
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
.data | |
array: .double 1.0 2.0 3.0 | |
.text | |
.globl main | |
main: | |
andi $sp, 0xfffffff8 | |
addi $sp, $sp, -24 |
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 | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 program" | |
exit 0 | |
fi | |
# Task granularity | |
taskgran="small" | |
nruns=10 |
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
#!/usr/bin/env io | |
# Egyptian fractions | |
# Load code from utest.io | |
doFile("utest.io") | |
# egypt(f) = 1 / ceil(y/x) + egypt((-y mod x) / (y * ceil(y/x))) | |
egypt := method(x, y, l, | |
r := (y / x) ceil | |
l append("1/#{r}" interpolate) |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <pthread.h> | |
#include <assert.h> | |
#include <signal.h> | |
#include <errno.h> | |
static pthread_t threads[2]; | |
static int IDs[2] = { 1, 2 }; |