assorted-commits Mailing List for Assorted projects (Page 56)
Brought to you by:
yangzhang
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(9) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(86) |
Feb
(265) |
Mar
(96) |
Apr
(47) |
May
(136) |
Jun
(28) |
Jul
(57) |
Aug
(42) |
Sep
(20) |
Oct
(67) |
Nov
(37) |
Dec
(34) |
2009 |
Jan
(39) |
Feb
(85) |
Mar
(96) |
Apr
(24) |
May
(82) |
Jun
(13) |
Jul
(10) |
Aug
(8) |
Sep
(2) |
Oct
(20) |
Nov
(31) |
Dec
(17) |
2010 |
Jan
(16) |
Feb
(11) |
Mar
(17) |
Apr
(53) |
May
(31) |
Jun
(13) |
Jul
(3) |
Aug
(6) |
Sep
(11) |
Oct
(4) |
Nov
(17) |
Dec
(17) |
2011 |
Jan
(3) |
Feb
(19) |
Mar
(5) |
Apr
(17) |
May
(3) |
Jun
(4) |
Jul
(14) |
Aug
(3) |
Sep
(2) |
Oct
(1) |
Nov
(3) |
Dec
(2) |
2012 |
Jan
(3) |
Feb
(7) |
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
(4) |
Aug
(5) |
Sep
(2) |
Oct
(3) |
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
(9) |
Apr
(5) |
May
|
Jun
(2) |
Jul
(1) |
Aug
(10) |
Sep
(1) |
Oct
(2) |
Nov
|
Dec
|
2014 |
Jan
(1) |
Feb
(3) |
Mar
(3) |
Apr
(1) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2016 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(5) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <yan...@us...> - 2008-02-29 03:58:54
|
Revision: 527 http://assorted.svn.sourceforge.net/assorted/?rev=527&view=rev Author: yangzhang Date: 2008-02-28 19:59:00 -0800 (Thu, 28 Feb 2008) Log Message: ----------- added web publishing script Modified Paths: -------------- simple-build/trunk/README simple-build/trunk/src/build-templates/cpp Added Paths: ----------- simple-build/trunk/publish.bash Modified: simple-build/trunk/README =================================================================== --- simple-build/trunk/README 2008-02-29 03:37:17 UTC (rev 526) +++ simple-build/trunk/README 2008-02-29 03:59:00 UTC (rev 527) @@ -111,9 +111,12 @@ is to one day be able to generate `autotools` inputs (as well as other kinds of software packaging). -- [Boost.Build]: A system for building C++ projects. Documentation hints that - it is capable of discovering transitive dependencies as well. This seems like - the closest thing to what I wanted. +- [Boost.Build]: A system for building C++ projects. Can discover only + transitive dependencies that can be found without relying on implicit + locations (such as those that are found via gcc's `CPATH`, `C_INCLUDE_PATH`, + `CXX_INCLUDE_PATH`, etc.). Contains a scripting language that I'm still + learning, but for simple configs, the language is terse and appears nice. The + community doesn't seem to be as active as CMake's. - [GNU `make`]: Currently, SimpleBuild targets only `make`. @@ -139,9 +142,9 @@ database came from here. - [CMake]: Cross-platform `make`. Uses its own quirky scripting language and - has quite a few features. I should probably target this. ["Why the KDE - project switched to CMake"] is a nice article on CMake (vs. auto* and SCons). - I've been using CMake as well. + has quite a few features. Kind of ugly. As always, long-tail configurations + are more painful. ["Why the KDE project switched to CMake"] is a nice article + on CMake (vs. auto* and SCons). I should target this. - [WAF]: An even simpler/more barren build system. You actually write imperative scripts for each build you need. A bit scary. Added: simple-build/trunk/publish.bash =================================================================== --- simple-build/trunk/publish.bash (rev 0) +++ simple-build/trunk/publish.bash 2008-02-29 03:59:00 UTC (rev 527) @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +clean=true +project=simple-build +websrcs=( README ) +webfiles=() +. assorted.bash || exit 1 Property changes on: simple-build/trunk/publish.bash ___________________________________________________________________ Name: svn:executable + * Modified: simple-build/trunk/src/build-templates/cpp =================================================================== --- simple-build/trunk/src/build-templates/cpp 2008-02-29 03:37:17 UTC (rev 526) +++ simple-build/trunk/src/build-templates/cpp 2008-02-29 03:59:00 UTC (rev 527) @@ -1,6 +1,7 @@ OBJDIR := $(OUTDIR)/$(TARGET)-obj -CFLAGS := $(CFLAGS) $(FLAGS) -CXXFLAGS := $(CXXFLAGS) $(FLAGS) +FLAGS := -Wall -Werror $(FLAGS) +CFLAGS := $(FLAGS) $(CFLAGS) +CXXFLAGS := $(FLAGS) $(CXXFLAGS) CPPFLAGS := $(CPPFLAGS) LDFLAGS := $(LDFLAGS) $(LIBS) $(AUTOLIBS) EXE := $(OUTDIR)/$(TARGET) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-29 03:37:11
|
Revision: 526 http://assorted.svn.sourceforge.net/assorted/?rev=526&view=rev Author: yangzhang Date: 2008-02-28 19:37:17 -0800 (Thu, 28 Feb 2008) Log Message: ----------- tweak Modified Paths: -------------- sandbox/trunk/src/bash/empty-array.bash Modified: sandbox/trunk/src/bash/empty-array.bash =================================================================== --- sandbox/trunk/src/bash/empty-array.bash 2008-02-29 03:35:26 UTC (rev 525) +++ sandbox/trunk/src/bash/empty-array.bash 2008-02-29 03:37:17 UTC (rev 526) @@ -6,6 +6,10 @@ arr=1 echo "${arr[@]}" +# This works. +arr=() +echo "${#arr}" + # This fails; apparently empty arrays expanded this way are unset variables. arr=() echo "${arr[@]}" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-29 03:35:21
|
Revision: 525 http://assorted.svn.sourceforge.net/assorted/?rev=525&view=rev Author: yangzhang Date: 2008-02-28 19:35:26 -0800 (Thu, 28 Feb 2008) Log Message: ----------- added empty-array test Added Paths: ----------- sandbox/trunk/src/bash/empty-array.bash Added: sandbox/trunk/src/bash/empty-array.bash =================================================================== --- sandbox/trunk/src/bash/empty-array.bash (rev 0) +++ sandbox/trunk/src/bash/empty-array.bash 2008-02-29 03:35:26 UTC (rev 525) @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -o nounset -o errexit + +# This works. +arr=1 +echo "${arr[@]}" + +# This fails; apparently empty arrays expanded this way are unset variables. +arr=() +echo "${arr[@]}" Property changes on: sandbox/trunk/src/bash/empty-array.bash ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-29 03:31:41
|
Revision: 524 http://assorted.svn.sourceforge.net/assorted/?rev=524&view=rev Author: yangzhang Date: 2008-02-28 19:31:47 -0800 (Thu, 28 Feb 2008) Log Message: ----------- added named, parent-dir (for assorted.bash) Modified Paths: -------------- shell-tools/trunk/src/bash-commons/common.bash Modified: shell-tools/trunk/src/bash-commons/common.bash =================================================================== --- shell-tools/trunk/src/bash-commons/common.bash 2008-02-29 03:31:33 UTC (rev 523) +++ shell-tools/trunk/src/bash-commons/common.bash 2008-02-29 03:31:47 UTC (rev 524) @@ -350,6 +350,24 @@ fi } +# For use with parent-dir. +named() { + [[ "$( basename "$( realpath "$2" )" )" == "$1" ]] && return 0 || return 1 +} + +# Recursively search parent directories until a directory is found that +# satisfies the given predicate. The predicate is the command formed from the +# arguments passed in. +parent-dir() { + local dir=. + while true ; do + if "$@" "$dir" ; then break ; fi + if [[ "$( realpath "$dir" )" == / ]] ; then return 1 ; fi + dir="$dir/.." + done + echo "$dir" +} + is-empty() { [[ -f "$1" && "$( stat -c%s "$1" )" == 0 ]] } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-29 03:31:27
|
Revision: 523 http://assorted.svn.sourceforge.net/assorted/?rev=523&view=rev Author: yangzhang Date: 2008-02-28 19:31:33 -0800 (Thu, 28 Feb 2008) Log Message: ----------- added boost build path Modified Paths: -------------- shell-tools/trunk/src/bash-commons/bashrc.bash Modified: shell-tools/trunk/src/bash-commons/bashrc.bash =================================================================== --- shell-tools/trunk/src/bash-commons/bashrc.bash 2008-02-29 03:31:18 UTC (rev 522) +++ shell-tools/trunk/src/bash-commons/bashrc.bash 2008-02-29 03:31:33 UTC (rev 523) @@ -166,6 +166,7 @@ #[ -z $OCAMLLIB ] && export OCAMLLIB="/usr/lib/ocaml" export CLASSPATH="." export TEXINPUTS=":/$HOME/.lyx/layouts/packages//" +export BOOST_BUILD_PATH=/opt/boost-build/share/boost-build # unison This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-29 03:31:15
|
Revision: 522 http://assorted.svn.sourceforge.net/assorted/?rev=522&view=rev Author: yangzhang Date: 2008-02-28 19:31:18 -0800 (Thu, 28 Feb 2008) Log Message: ----------- added assorted.bash Added Paths: ----------- shell-tools/trunk/src/bash-commons/assorted.bash Added: shell-tools/trunk/src/bash-commons/assorted.bash =================================================================== --- shell-tools/trunk/src/bash-commons/assorted.bash (rev 0) +++ shell-tools/trunk/src/bash-commons/assorted.bash 2008-02-29 03:31:18 UTC (rev 522) @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# This is a common include file for all project configuration scripts for +# Assorted Projects. + +. common.bash || exit 1 + +root_site_dir="$( parent-dir named assorted )/assorted-site/trunk" +clean= +prof=shell-sf +base_web_dir=assorted/htdocs +webdir=$base_web_dir/public_html +stagedir="$( mktemp -d )" + +cp -r "${webfiles[@]}" "$stagedir" + +for src in "${websrcs[@]}" ; do + if [[ src == README ]] + then out=index.html + else out="$( basename "${src%.*}.html" )" + fi + pandoc -s -S --tab-stop=2 \ + -c http://assorted.sf.net/main.css \ + -H "$(root_site_dir)/header.html" \ + -A "$(root_site_dir)/footer.html" \ + -o "$stagedir/$out" "$src" +done + +tar czf - -C "$stagedir" . | +ssh $prof " + set -o errexit -o nounset + if [[ $clean ]] ; then rm -r $webdir ; fi + mkdir -p $webdir + cd $webdir + tar xzf - +" Property changes on: shell-tools/trunk/src/bash-commons/assorted.bash ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-29 03:29:17
|
Revision: 521 http://assorted.svn.sourceforge.net/assorted/?rev=521&view=rev Author: yangzhang Date: 2008-02-28 19:29:14 -0800 (Thu, 28 Feb 2008) Log Message: ----------- changed local -> .local; i should really remove this script Modified Paths: -------------- shell-tools/trunk/src/refresh-links.bash Modified: shell-tools/trunk/src/refresh-links.bash =================================================================== --- shell-tools/trunk/src/refresh-links.bash 2008-02-29 03:28:55 UTC (rev 520) +++ shell-tools/trunk/src/refresh-links.bash 2008-02-29 03:29:14 UTC (rev 521) @@ -6,8 +6,8 @@ do_force= do_time= do_verbose= -crawl_dirs="$HOME/local" -link_dir="$HOME/local" +crawl_dirs="$HOME/.local" +link_dir="$HOME/.local" usage="Usage: $cmd_name [OPTIONS] [DIR...] If no dirs are specified, then defaults to ${crawl_dirs[@]} Options: @@ -50,7 +50,7 @@ fi # Warning: don't change this to remove $link_dir! This is frequently the same -# as $crawl_dir, e.g. ~/local. +# as $crawl_dir, e.g. ~/.local. for dir in bin include info lib man/man{1,2,3,4,5,6,7,8} sbin ; do noerr rm -r "$link_dir/$dir/" || true done This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-29 03:28:57
|
Revision: 520 http://assorted.svn.sourceforge.net/assorted/?rev=520&view=rev Author: yangzhang Date: 2008-02-28 19:28:55 -0800 (Thu, 28 Feb 2008) Log Message: ----------- fixed some unbound variable bugs Modified Paths: -------------- shell-tools/trunk/src/bash-commons/simple-setup.bash Modified: shell-tools/trunk/src/bash-commons/simple-setup.bash =================================================================== --- shell-tools/trunk/src/bash-commons/simple-setup.bash 2008-02-27 04:11:18 UTC (rev 519) +++ shell-tools/trunk/src/bash-commons/simple-setup.bash 2008-02-29 03:28:55 UTC (rev 520) @@ -5,6 +5,7 @@ new_version=$(( BASH_VERSINFO[0] >= 3 && BASH_VERSINFO[1] >= 1 )) host= +do_remote= do_remove= do_dev= prefix="/opt/${pkg:?}" @@ -58,7 +59,7 @@ } install_raw() { - local do_strip_ext="$1" do_copy="$2" dst="$3" + local do_strip_ext="$1" do_copy="$2" dst="$3" do_dest_path= if [[ "${dst#/}" == "$dst" ]] ; then dst="$prefix/$dst" else @@ -80,7 +81,7 @@ fi local dstdir="$( dirname "$dst" )/" local dstname="$( basename "$dst" )" - local do_dest_path=1 + do_dest_path=1 else local dstdir="$dst" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-27 04:11:15
|
Revision: 519 http://assorted.svn.sourceforge.net/assorted/?rev=519&view=rev Author: yangzhang Date: 2008-02-26 20:11:18 -0800 (Tue, 26 Feb 2008) Log Message: ----------- added simple who-is-it script Added Paths: ----------- sandbox/trunk/src/py/whoisit.py Added: sandbox/trunk/src/py/whoisit.py =================================================================== --- sandbox/trunk/src/py/whoisit.py (rev 0) +++ sandbox/trunk/src/py/whoisit.py 2008-02-27 04:11:18 UTC (rev 519) @@ -0,0 +1,8 @@ +#!/usr/bin/env python + +from socket import * +s=socket() +s.bind(('harvard.csail.mit.edu',9876)) +s.listen(1) +t,u=s.accept() +print t.getpeername() Property changes on: sandbox/trunk/src/py/whoisit.py ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-27 04:00:39
|
Revision: 518 http://assorted.svn.sourceforge.net/assorted/?rev=518&view=rev Author: yangzhang Date: 2008-02-26 20:00:45 -0800 (Tue, 26 Feb 2008) Log Message: ----------- added topcoder stuff Modified Paths: -------------- configs/trunk/TODO Added Paths: ----------- configs/trunk/src/contestapplet.conf Modified: configs/trunk/TODO =================================================================== --- configs/trunk/TODO 2008-02-26 20:49:46 UTC (rev 517) +++ configs/trunk/TODO 2008-02-27 04:00:45 UTC (rev 518) @@ -1 +1,2 @@ mv bashrc.bash into here from shell-tools +deal with topcoder Added: configs/trunk/src/contestapplet.conf =================================================================== --- configs/trunk/src/contestapplet.conf (rev 0) +++ configs/trunk/src/contestapplet.conf 2008-02-27 04:00:45 UTC (rev 518) @@ -0,0 +1,225 @@ +// vim:noet:sw=2:ts=2 + +// TODO +// - strip out all comments +// - trim the unused includes/macros/typedefs/code + +// $BEGINREUSE$ +#include <algorithm> +#include <cassert> +#include <cctype> +#include <cmath> +#include <cstdio> +#include <cstdlib> +#include <deque> +#include <functional> +#include <iostream> +#include <map> +#include <queue> +#include <set> +#include <sstream> +#include <stack> +#include <string> +#include <vector> +using namespace std; + +#define dd(x) cout << #x << " = " << x << endl +#define len length() +#define sz size() +#define pb(x) push_back((x)); +#define all(A) (A).begin(), (A).end() +#define rall(A) (A).rbegin(), (A).rend() +#define forea(it,xs) for (typeof(xs.begin()) it = xs.begin(); it != xs.end(); it++) +#define FOR(i,xs) for (typeof((xs).size()) i = 0; i < (xs).size(); i++) +#define FOR(i,l,h) for (typeof(l) i = (l); i < (h); i++) + +// CHOOSE +//int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1}; +//int dx[] = {1,1,1,0,0,-1,-1,-1}, dy[] = {1,0,-1,1,-1,1,0,-1}; + +typedef vector<int> vi; +typedef vector<string> vs; +typedef vector<bool> vb; +typedef vector<vi> vvi; +typedef vector<vs> vvs; +typedef vector<vb> vvb; +typedef long long ll; +typedef vector vec; // XXX +typedef string str; + +template<typename T> inline T mod(T a, T b) { return (a % b + b) % b; } +template<typename T> inline void rev(T xs) { std::reverse(all(xs)); } +template<typename T> inline void sort(T xs) { std::sort(all(xs)); } +template<typename T> inline void ssort(T xs) { std::stable_sort(all(xs)); } +template<typename T> inline void unique(T xs) { std::unique(all(xs)); } +template<typename T> inline void uniq(T xs) { xs.erase( std::unique(all(xs)), xs.end() ); } +template<typename T, typename U> inline void fill(T xs, U x) { std::fill(all(xs), x); } +template<typename T, typename U> inline U minim(const T xs) { return *std::min_element(all(xs)); } +template<typename T, typename U> inline U maxim(const T xs) { return *std::max_element(all(xs)); } +template<typename T> inline void nextp(T xs) { return std::next_permutation(all(xs)); } +template<typename T> inline void prevp(T xs) { return std::prev_permutation(all(xs)); } +template<typename T> inline string tos(T x) { stringstream s; s << x; return s.str(); } +inline int powi(int a, int b) { return int( std::pow(double(a), double(b)) ); } +inline int powl(ll a, ll b) { return ll( std::pow(double(a), double(b)) ); } +template<typename T> inline void pp(const T & x) { cout << x << endl; } + +inline ll gcd(ll a, ll b) { + if (a < 0 && b < 0) return gcd(-a,-b); + if (a == 0) return b; + if (b == 0) return a; + if (a > b) return gcd(b, a); + if (!(b % a)) return a; + return gcd(a, b % a); +} + +// TODO merge the following two pieces of code together + +template <typename T> +inline ostream& operator << (ostream& os, const set<T> & xs) { + FOR(i,xs) os << i ? ", " : "{ " << xs[i]; + return os << " }"; +} + +template <typename T> +inline ostream& operator << (ostream& os, const vector<T> & xs) { + FOR(i,xs) os << i ? ", " : "{ " << xs[i]; + return os << " }"; +} + +template<class S,class T> +inline ostream & operator << (ostream & os, const pair<S,T> & a) { + os << "(" << a.first << ", " << a.second << ")"; + return os; +} + +vs split( const string & s, const string & delim = " " ) { + vs res; + string t; + forea(c,s) { + if ( delim.find( c ) != string::npos ) { + if ( !t.empty() ) { + res.pb( t ); + t = ""; + } + } else { + t += c; + } + } + if ( ! t.empty() ) { + res.push_back(t); + } + return res; +} + +vi ints( const str & s, const str & delim = " " ) { + vs ss = split( s, delim ); + vi is; + forea(s,ss) is.push_back( atoi( s.c_str() ) ); + return is; +} + +// following is needed for 'main' +#define ARRSIZE(x) (sizeof(x)/sizeof(x[0])) +// $ENDREUSE$ + + + + + + + +$BEGINCUT$ +template<typename T> void print( T a ) { + cerr << a; +} +static void print( long long a ) { + cerr << a << "L"; +} +static void print( string a ) { + cerr << '"' << a << '"'; +} +template<typename T> void print( vector<T> a ) { + cerr << "{"; + for ( int i = 0 ; i != a.size() ; i++ ) { + if ( i != 0 ) cerr << ", "; + print( a[i] ); + } + cerr << "}" << endl; +} +template<typename T> void eq( int n, T have, T need ) { + if ( have == need ) { + cerr << "Case " << n << " passed." << endl; + } else { + cerr << "Case " << n << " failed: expected "; + print( need ); + cerr << " received "; + print( have ); + cerr << "." << endl; + } +} +template<typename T> void eq( int n, vector<T> have, vector<T> need ) { + if( have.size() != need.size() ) { + cerr << "Case " << n << " failed: returned " << have.size() << " elements; expected " << need.size() << " elements." << endl; + cerr << " have: "; print( have ); + cerr << " need: "; print( need ); + return; + } + for( size_t i= 0; i < have.size(); i++ ) { + if( have[i] != need[i] ) { + cerr << "Case " << n << " failed. Expected and returned array differ in position " << i << "." << endl; + cerr << " have: "; print( have ); + cerr << " need: "; print( need ); + return; + } + } + cerr << "Case " << n << " passed." << endl; +} +static void eq( int n, string have, string need ) { + if ( have == need ) { + cerr << "Case " << n << " passed." << endl; + } else { + cerr << "Case " << n << " failed: expected "; + print( need ); + cerr << " received "; + print( have ); + cerr << "." << endl; + } +} +$ENDCUT$ + + + + + + + + + + + + + +class $CLASSNAME$ { + public: + $RC$ $METHODNAME$($METHODPARMS$) { + $RC$ res; + return res; + } +}; + + + + + + + +$BEGINCUT$ +int main() { +$MAINBODY$ +#ifdef WIN32 + cin.get(); +#endif + return 0; +} +$ENDCUT$ + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-26 20:49:51
|
Revision: 517 http://assorted.svn.sourceforge.net/assorted/?rev=517&view=rev Author: yangzhang Date: 2008-02-26 12:49:46 -0800 (Tue, 26 Feb 2008) Log Message: ----------- fixed links Modified Paths: -------------- numa-bench/trunk/doc/analysis.txt Modified: numa-bench/trunk/doc/analysis.txt =================================================================== --- numa-bench/trunk/doc/analysis.txt 2008-02-26 20:48:46 UTC (rev 516) +++ numa-bench/trunk/doc/analysis.txt 2008-02-26 20:49:46 UTC (rev 517) @@ -32,9 +32,9 @@ - Read vs. write - Substantial difference. Random writes are ~2x slower than random reads. - Compare - [a](graphs/ncores-16-size-1000000000-nreps-1-shuffle-0-par-0-pin-1-local-0-write-0-cross-0.pdf) + [a](graphs/ncores-16-size-100000000-nreps-1-shuffle-1-par-0-pin-1-local-0-write-0-cross-0.pdf) and - [b](graphs/ncores-16-size-1000000000-nreps-1-shuffle-0-par-0-pin-1-local-0-write-1-cross-0.pdf) + [b](graphs/ncores-16-size-100000000-nreps-1-shuffle-1-par-0-pin-1-local-0-write-1-cross-0.pdf) - Does `malloc` tend to allocate locally? - Yes, because working with memory allocated from the current thread shows improved times. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-26 20:48:44
|
Revision: 516 http://assorted.svn.sourceforge.net/assorted/?rev=516&view=rev Author: yangzhang Date: 2008-02-26 12:48:46 -0800 (Tue, 26 Feb 2008) Log Message: ----------- removed unnecessary assertion Modified Paths: -------------- numa-bench/trunk/src/chew.cc Modified: numa-bench/trunk/src/chew.cc =================================================================== --- numa-bench/trunk/src/chew.cc 2008-02-26 20:31:16 UTC (rev 515) +++ numa-bench/trunk/src/chew.cc 2008-02-26 20:48:46 UTC (rev 516) @@ -231,8 +231,6 @@ << " nnodes " << config.nnodes << endl; - checkmsg(RAND_MAX > config.size / sizeof(int), "PRNG range not large enough"); - void *p = malloc(config.size); check(p != NULL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-26 20:31:17
|
Revision: 515 http://assorted.svn.sourceforge.net/assorted/?rev=515&view=rev Author: yangzhang Date: 2008-02-26 12:31:16 -0800 (Tue, 26 Feb 2008) Log Message: ----------- updated simple-build makefile Modified Paths: -------------- numa-bench/trunk/src/GNUmakefile Modified: numa-bench/trunk/src/GNUmakefile =================================================================== --- numa-bench/trunk/src/GNUmakefile 2008-02-26 20:31:00 UTC (rev 514) +++ numa-bench/trunk/src/GNUmakefile 2008-02-26 20:31:16 UTC (rev 515) @@ -14,8 +14,9 @@ FLAGS_0 := -g3 OBJDIR_0 := $(OUTDIR)/$(TARGET_0)-obj -CFLAGS_0 := $(CFLAGS) $(FLAGS_0) -CXXFLAGS_0 := $(CXXFLAGS) $(FLAGS_0) +FLAGS_0 := -Wall -Werror $(FLAGS_0) +CFLAGS_0 := $(FLAGS_0) $(CFLAGS) +CXXFLAGS_0 := $(FLAGS_0) $(CXXFLAGS) CPPFLAGS_0 := $(CPPFLAGS) LDFLAGS_0 := $(LDFLAGS) $(LIBS_0) $(AUTOLIBS_0) EXE_0 := $(OUTDIR)/$(TARGET_0) @@ -71,8 +72,9 @@ FLAGS_1 := -O3 OBJDIR_1 := $(OUTDIR)/$(TARGET_1)-obj -CFLAGS_1 := $(CFLAGS) $(FLAGS_1) -CXXFLAGS_1 := $(CXXFLAGS) $(FLAGS_1) +FLAGS_1 := -Wall -Werror $(FLAGS_1) +CFLAGS_1 := $(FLAGS_1) $(CFLAGS) +CXXFLAGS_1 := $(FLAGS_1) $(CXXFLAGS) CPPFLAGS_1 := $(CPPFLAGS) LDFLAGS_1 := $(LDFLAGS) $(LIBS_1) $(AUTOLIBS_1) EXE_1 := $(OUTDIR)/$(TARGET_1) @@ -128,8 +130,9 @@ FLAGS_2 := -pg OBJDIR_2 := $(OUTDIR)/$(TARGET_2)-obj -CFLAGS_2 := $(CFLAGS) $(FLAGS_2) -CXXFLAGS_2 := $(CXXFLAGS) $(FLAGS_2) +FLAGS_2 := -Wall -Werror $(FLAGS_2) +CFLAGS_2 := $(FLAGS_2) $(CFLAGS) +CXXFLAGS_2 := $(FLAGS_2) $(CXXFLAGS) CPPFLAGS_2 := $(CPPFLAGS) LDFLAGS_2 := $(LDFLAGS) $(LIBS_2) $(AUTOLIBS_2) EXE_2 := $(OUTDIR)/$(TARGET_2) @@ -193,8 +196,9 @@ FLAGS_3 := -g3 OBJDIR_3 := $(OUTDIR)/$(TARGET_3)-obj -CFLAGS_3 := $(CFLAGS) $(FLAGS_3) -CXXFLAGS_3 := $(CXXFLAGS) $(FLAGS_3) +FLAGS_3 := -Wall -Werror $(FLAGS_3) +CFLAGS_3 := $(FLAGS_3) $(CFLAGS) +CXXFLAGS_3 := $(FLAGS_3) $(CXXFLAGS) CPPFLAGS_3 := $(CPPFLAGS) LDFLAGS_3 := $(LDFLAGS) $(LIBS_3) $(AUTOLIBS_3) EXE_3 := $(OUTDIR)/$(TARGET_3) @@ -250,8 +254,9 @@ FLAGS_4 := -O3 OBJDIR_4 := $(OUTDIR)/$(TARGET_4)-obj -CFLAGS_4 := $(CFLAGS) $(FLAGS_4) -CXXFLAGS_4 := $(CXXFLAGS) $(FLAGS_4) +FLAGS_4 := -Wall -Werror $(FLAGS_4) +CFLAGS_4 := $(FLAGS_4) $(CFLAGS) +CXXFLAGS_4 := $(FLAGS_4) $(CXXFLAGS) CPPFLAGS_4 := $(CPPFLAGS) LDFLAGS_4 := $(LDFLAGS) $(LIBS_4) $(AUTOLIBS_4) EXE_4 := $(OUTDIR)/$(TARGET_4) @@ -307,8 +312,9 @@ FLAGS_5 := -pg OBJDIR_5 := $(OUTDIR)/$(TARGET_5)-obj -CFLAGS_5 := $(CFLAGS) $(FLAGS_5) -CXXFLAGS_5 := $(CXXFLAGS) $(FLAGS_5) +FLAGS_5 := -Wall -Werror $(FLAGS_5) +CFLAGS_5 := $(FLAGS_5) $(CFLAGS) +CXXFLAGS_5 := $(FLAGS_5) $(CXXFLAGS) CPPFLAGS_5 := $(CPPFLAGS) LDFLAGS_5 := $(LDFLAGS) $(LIBS_5) $(AUTOLIBS_5) EXE_5 := $(OUTDIR)/$(TARGET_5) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-26 20:30:58
|
Revision: 514 http://assorted.svn.sourceforge.net/assorted/?rev=514&view=rev Author: yangzhang Date: 2008-02-26 12:31:00 -0800 (Tue, 26 Feb 2008) Log Message: ----------- added round-robin node allocation; renamed cores to cpus Modified Paths: -------------- numa-bench/trunk/src/chew.bash numa-bench/trunk/src/chew.cc Modified: numa-bench/trunk/src/chew.bash =================================================================== --- numa-bench/trunk/src/chew.bash 2008-02-26 19:48:37 UTC (rev 513) +++ numa-bench/trunk/src/chew.bash 2008-02-26 20:31:00 UTC (rev 514) @@ -12,32 +12,32 @@ KB=000 MB=000000 GB=000000000 -# ncores size nreps shuffle par pin local write cross +# ncpus size nreps shuffle par pin local write cross rrnodes echo writes -run 16 100$MB 1 0 0 1 0 1 0 -run 16 1000$MB 1 0 0 1 0 1 0 -run 16 100$MB 10 0 0 1 0 1 0 -run 16 100$MB 1 1 0 1 0 1 0 +run 16 100$MB 1 0 0 1 0 1 0 1 +run 16 1000$MB 1 0 0 1 0 1 0 1 +run 16 100$MB 10 0 0 1 0 1 0 1 +run 16 100$MB 1 1 0 1 0 1 0 1 echo reads -run 16 1000$MB 1 0 0 1 0 0 0 -run 16 100$MB 1 1 0 1 0 0 0 +run 16 1000$MB 1 0 0 1 0 0 0 1 +run 16 100$MB 1 1 0 1 0 0 0 1 for n in 1 2 4 8 12 16 ; do echo par - run $n 10$MB 1 0 1 1 0 0 0 - run $n 10$MB 1 1 1 1 0 0 0 - run $n 10$MB 1 0 1 1 1 0 0 - run $n 10$MB 1 1 1 1 1 0 0 - run $n 10$MB 1 0 1 1 0 1 0 - run $n 10$MB 1 1 1 1 0 1 0 - run $n 10$MB 1 0 1 1 1 1 0 - run $n 10$MB 1 1 1 1 1 1 0 + run $n 10$MB 1 0 1 1 0 0 0 1 + run $n 10$MB 1 1 1 1 0 0 0 1 + run $n 10$MB 1 0 1 1 1 0 0 1 + run $n 10$MB 1 1 1 1 1 0 0 1 + run $n 10$MB 1 0 1 1 0 1 0 1 + run $n 10$MB 1 1 1 1 0 1 0 1 + run $n 10$MB 1 0 1 1 1 1 0 1 + run $n 10$MB 1 1 1 1 1 1 0 1 echo cross - run $n 10$MB 1 0 1 1 0 0 1 - run $n 10$MB 1 1 1 1 0 0 1 - run $n 10$MB 1 0 1 1 0 1 1 - run $n 10$MB 1 1 1 1 0 1 1 + run $n 10$MB 1 0 1 1 0 0 1 1 + run $n 10$MB 1 1 1 1 0 0 1 1 + run $n 10$MB 1 0 1 1 0 1 1 1 + run $n 10$MB 1 1 1 1 0 1 1 1 done Modified: numa-bench/trunk/src/chew.cc =================================================================== --- numa-bench/trunk/src/chew.cc 2008-02-26 19:48:37 UTC (rev 513) +++ numa-bench/trunk/src/chew.cc 2008-02-26 20:31:00 UTC (rev 514) @@ -20,12 +20,12 @@ struct config { /** - * The number of cores to test. This is a parameter (rather than - * auto-detected) because it additionally serves to mean the number of cores + * The number of CPUs to test. This is a parameter (rather than + * auto-detected) because it additionally serves to mean the number of CPUs * we want to test in parallel. As this program evolves, these may be * separated. */ - const int ncores; + const unsigned int ncpus; /** * Size in bytes of the buffer to chew. @@ -35,7 +35,7 @@ /** * Number of repetitions to chew. */ - const int nreps; + const unsigned int nreps; /** * Perform rand access, otherwise sequential scan. @@ -43,12 +43,13 @@ const bool shuffle; /** - * Chew in parallel, otherwise each core chews serially. + * Chew in parallel, otherwise each worker chews serially. */ const bool par; /** - * Pin thread i to core i, otherwise let the OS manage things. + * Pin workers to CPUs (which CPU determined by whether we're using + * round-robin CPU allocation), otherwise let the OS manage things. */ const bool pin; @@ -67,6 +68,17 @@ * global/local buffer. */ const bool cross; + + /** + * When using fewer than the maximum number of CPUs, allocate nodes in + * round-robin fashion. + */ + const bool rrnodes; + + /** + * The number of nodes on this machine. + */ + const unsigned int nnodes; }; void*** partitions; @@ -129,15 +141,21 @@ /** * \param pp The start of the buffer to chew. - * \param cpu Which CPU to pin our thread to. + * \param worker From this we can determine which CPU to pin our thread to. * \param config The experiment configuration parameters. * \param label Prefix for the elapsed time output. */ void* -chew(void* pp, unsigned int cpu, const config & config, bool warmup) +chew(void* pp, unsigned int worker, const config & config, bool warmup) { - // Pin this thread to cpu `cpu`. + // Pin this thread to a CPU. if (config.pin) { + unsigned int ncpus = config.ncpus, + nnodes = config.nnodes, + cpuspernode = ncpus / nnodes, + cpu = !config.rrnodes ? + worker : + (cpuspernode * worker) % ncpus + worker / cpuspernode; pin_thread(cpu); } @@ -145,16 +163,17 @@ timer t(": "); if (!warmup && config.cross) { - size_t len = config.size / config.ncores; - for (int i = 0; i < config.ncores; i++) { - partitions[cpu][i] = new char[len]; + size_t len = config.size / config.ncpus; + for (unsigned int i = 0; i < config.ncpus; i++) { + partitions[worker][i] = new char[len]; } int barrier_result = pthread_barrier_wait(&cross_barrier); - check(barrier_result == PTHREAD_BARRIER_SERIAL_THREAD || barrier_result == 0); + check(barrier_result == PTHREAD_BARRIER_SERIAL_THREAD || + barrier_result == 0); // TODO: make this more interesting than just a sequential traversal over // the partitions. - for (int i = 0; i < config.ncores; i++) { - chew1(partitions[i][cpu], config, len); + for (unsigned int i = 0; i < config.ncpus; i++) { + chew1(partitions[i][worker], config, len); } } else { chew1(p, config, config.size); @@ -162,7 +181,7 @@ // Print the elapsed time and "result". if (warmup) cout << "warmup: "; - cout << cpu; + cout << worker; t.print(); if (config.local) free(p); @@ -176,27 +195,30 @@ // So that our global shared malloc takes place on the CPU 0's node. pin_thread(0); - if (argc < 10) { + if (argc < 11) { cerr << argv[0] << - " <ncores> <size> <nreps> <shuffle> <par> <pin> <local> <write>" << endl; + " <ncpus> <size> <nreps> <shuffle> <par> <pin>" + " <local> <write> <rrnodes> <nnodes>" << endl; return 1; } - // Parse command-line arguments. TODO - const config config = { - atoi(argv[1]), - atoi(argv[2]), - atoi(argv[3]), - atoi(argv[4]), - atoi(argv[5]), - atoi(argv[6]), - atoi(argv[7]), - atoi(argv[8]), - atoi(argv[9]) + // Parse command-line arguments. + const config config = { + atoi(argv[ 1]), + atoi(argv[ 2]), + atoi(argv[ 3]), + atoi(argv[ 4]), + atoi(argv[ 5]), + atoi(argv[ 6]), + atoi(argv[ 7]), + atoi(argv[ 8]), + atoi(argv[ 9]), + atoi(argv[10]), + atoi(argv[11]) }; cout << "config:" - << " ncores " << config.ncores + << " ncpus " << config.ncpus << " size " << config.size << " nreps " << config.nreps << " shuffle " << config.shuffle @@ -204,7 +226,10 @@ << " pin " << config.pin << " local " << config.local << " write " << config.write - << " cross " << config.cross << endl; + << " cross " << config.cross + << " rrnodes " << config.rrnodes + << " nnodes " << config.nnodes + << endl; checkmsg(RAND_MAX > config.size / sizeof(int), "PRNG range not large enough"); @@ -212,9 +237,9 @@ check(p != NULL); if (config.cross) { - partitions = new void**[config.ncores]; - for (unsigned int i = 0; i < config.ncores; i++) - partitions[i] = new void*[config.ncores]; + partitions = new void**[config.ncpus]; + for (unsigned int i = 0; i < config.ncpus; i++) + partitions[i] = new void*[config.ncpus]; } // Warmup. @@ -222,18 +247,18 @@ if (config.par) { // Chew the memory area from each core in parallel (and also chew own). - pthread_t ts[config.ncores]; - check(0 == pthread_barrier_init(&cross_barrier, NULL, config.ncores)); - for (int i = 0; i < config.ncores; i++) { + pthread_t ts[config.ncpus]; + check(0 == pthread_barrier_init(&cross_barrier, NULL, config.ncpus)); + for (unsigned int i = 0; i < config.ncpus; i++) { ts[i] = spawn(bind(chew, p, i, ref(config), false)); } - for (int i = 0; i < config.ncores; i++) { + for (unsigned int i = 0; i < config.ncpus; i++) { check(pthread_join(ts[i], NULL) == 0); } check(0 == pthread_barrier_destroy(&cross_barrier)); } else { // Chew the memory area from each core in sequence. - for (int i = 0; i < config.ncores; i++) { + for (unsigned int i = 0; i < config.ncpus; i++) { chew(p, i, config, false); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-26 19:48:39
|
Revision: 513 http://assorted.svn.sourceforge.net/assorted/?rev=513&view=rev Author: yangzhang Date: 2008-02-26 11:48:37 -0800 (Tue, 26 Feb 2008) Log Message: ----------- renamed malloc to chew Modified Paths: -------------- numa-bench/trunk/src/CMakeLists.txt numa-bench/trunk/src/GNUmakefile numa-bench/trunk/src/Jamroot numa-bench/trunk/src/build Added Paths: ----------- numa-bench/trunk/src/chew.bash numa-bench/trunk/src/chew.cc Removed Paths: ------------- numa-bench/trunk/src/malloc.bash numa-bench/trunk/src/malloc.cc Modified: numa-bench/trunk/src/CMakeLists.txt =================================================================== --- numa-bench/trunk/src/CMakeLists.txt 2008-02-26 19:41:17 UTC (rev 512) +++ numa-bench/trunk/src/CMakeLists.txt 2008-02-26 19:48:37 UTC (rev 513) @@ -1,7 +1,7 @@ project (numa-bench) -add_executable (malloc malloc.cc) -target_link_libraries (malloc pthread) +add_executable (chew chew.cc) +target_link_libraries (chew pthread) add_executable (avail avail.cc) target_link_libraries (avail numa) Modified: numa-bench/trunk/src/GNUmakefile =================================================================== --- numa-bench/trunk/src/GNUmakefile 2008-02-26 19:41:17 UTC (rev 512) +++ numa-bench/trunk/src/GNUmakefile 2008-02-26 19:48:37 UTC (rev 513) @@ -1,16 +1,16 @@ OUTDIR := /home/yang/work/assorted/numa-bench/trunk/src/out SRCDIR := /home/yang/work/assorted/numa-bench/trunk/src SRCPATH := /home/yang/work/assorted/numa-bench/trunk/src -all: malloc avail -PREFIX_0 := /opt/malloc +all: chew avail +PREFIX_0 := /opt/chew BINDIR_0 := $(PREFIX_0)/bin LIBS_0 := -lpthread -SRCS_0 := $(SRCDIR)/malloc.cc -ORIGTARGET_0 := malloc +SRCS_0 := $(SRCDIR)/chew.cc +ORIGTARGET_0 := chew AUTOLIBS_0 := LANG_0 := cpp -TARGET_0 := malloc-dbg +TARGET_0 := chew-dbg FLAGS_0 := -g3 OBJDIR_0 := $(OUTDIR)/$(TARGET_0)-obj @@ -59,15 +59,15 @@ $(ORIGTARGET_0): $(TARGET_0) .PHONY: $(ORIGTARGET_0) -PREFIX_1 := /opt/malloc +PREFIX_1 := /opt/chew BINDIR_1 := $(PREFIX_1)/bin LIBS_1 := -lpthread -SRCS_1 := $(SRCDIR)/malloc.cc -ORIGTARGET_1 := malloc +SRCS_1 := $(SRCDIR)/chew.cc +ORIGTARGET_1 := chew AUTOLIBS_1 := LANG_1 := cpp -TARGET_1 := malloc-opt +TARGET_1 := chew-opt FLAGS_1 := -O3 OBJDIR_1 := $(OUTDIR)/$(TARGET_1)-obj @@ -116,15 +116,15 @@ $(ORIGTARGET_1): $(TARGET_1) .PHONY: $(ORIGTARGET_1) -PREFIX_2 := /opt/malloc +PREFIX_2 := /opt/chew BINDIR_2 := $(PREFIX_2)/bin LIBS_2 := -lpthread -SRCS_2 := $(SRCDIR)/malloc.cc -ORIGTARGET_2 := malloc +SRCS_2 := $(SRCDIR)/chew.cc +ORIGTARGET_2 := chew AUTOLIBS_2 := LANG_2 := cpp -TARGET_2 := malloc-gprof +TARGET_2 := chew-gprof FLAGS_2 := -pg OBJDIR_2 := $(OUTDIR)/$(TARGET_2)-obj Modified: numa-bench/trunk/src/Jamroot =================================================================== --- numa-bench/trunk/src/Jamroot 2008-02-26 19:41:17 UTC (rev 512) +++ numa-bench/trunk/src/Jamroot 2008-02-26 19:48:37 UTC (rev 513) @@ -1,2 +1,2 @@ lib pthread ; -exe malloc : malloc.cc pthread : <toolset>gcc:<cxxflags>-g3 ; +exe chew : chew.cc pthread : <toolset>gcc:<cxxflags>-g3 ; Modified: numa-bench/trunk/src/build =================================================================== --- numa-bench/trunk/src/build 2008-02-26 19:41:17 UTC (rev 512) +++ numa-bench/trunk/src/build 2008-02-26 19:48:37 UTC (rev 513) @@ -1,5 +1,5 @@ -malloc: - srcs: [malloc.cc] +chew: + srcs: [chew.cc] libs: [pthread] avail: Copied: numa-bench/trunk/src/chew.bash (from rev 511, numa-bench/trunk/src/malloc.bash) =================================================================== --- numa-bench/trunk/src/chew.bash (rev 0) +++ numa-bench/trunk/src/chew.bash 2008-02-26 19:48:37 UTC (rev 513) @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +set -o errexit -o nounset + +make -s chew-opt + +function run { + for i in {1..3} + do out/chew-opt "$@" + done +} + +KB=000 MB=000000 GB=000000000 + +# ncores size nreps shuffle par pin local write cross + +echo writes +run 16 100$MB 1 0 0 1 0 1 0 +run 16 1000$MB 1 0 0 1 0 1 0 +run 16 100$MB 10 0 0 1 0 1 0 +run 16 100$MB 1 1 0 1 0 1 0 + +echo reads +run 16 1000$MB 1 0 0 1 0 0 0 +run 16 100$MB 1 1 0 1 0 0 0 + +for n in 1 2 4 8 12 16 ; do + echo par + run $n 10$MB 1 0 1 1 0 0 0 + run $n 10$MB 1 1 1 1 0 0 0 + run $n 10$MB 1 0 1 1 1 0 0 + run $n 10$MB 1 1 1 1 1 0 0 + run $n 10$MB 1 0 1 1 0 1 0 + run $n 10$MB 1 1 1 1 0 1 0 + run $n 10$MB 1 0 1 1 1 1 0 + run $n 10$MB 1 1 1 1 1 1 0 + + echo cross + run $n 10$MB 1 0 1 1 0 0 1 + run $n 10$MB 1 1 1 1 0 0 1 + run $n 10$MB 1 0 1 1 0 1 1 + run $n 10$MB 1 1 1 1 0 1 1 +done Copied: numa-bench/trunk/src/chew.cc (from rev 512, numa-bench/trunk/src/malloc.cc) =================================================================== --- numa-bench/trunk/src/chew.cc (rev 0) +++ numa-bench/trunk/src/chew.cc 2008-02-26 19:48:37 UTC (rev 513) @@ -0,0 +1,246 @@ +#include <fstream> +#include <iostream> + +#include <sched.h> + +#include <boost/bind.hpp> + +#include <commons/check.h> +#include <commons/rand.h> +#include <commons/threads.h> +#include <commons/time.h> +#include <commons/boost/threads.h> + +using namespace boost; +using namespace commons; +using namespace std; + +pthread_barrier_t cross_barrier; + +struct config +{ + /** + * The number of cores to test. This is a parameter (rather than + * auto-detected) because it additionally serves to mean the number of cores + * we want to test in parallel. As this program evolves, these may be + * separated. + */ + const int ncores; + + /** + * Size in bytes of the buffer to chew. + */ + const size_t size; + + /** + * Number of repetitions to chew. + */ + const int nreps; + + /** + * Perform rand access, otherwise sequential scan. + */ + const bool shuffle; + + /** + * Chew in parallel, otherwise each core chews serially. + */ + const bool par; + + /** + * Pin thread i to core i, otherwise let the OS manage things. + */ + const bool pin; + + /** + * Chew my own memory, otherwise chew the given (shared) memory. + */ + const bool local; + + /** + * Do writes, otherwise just do reads. + */ + const bool write; + + /** + * Test cross-communication (use partitions), otherwise use either the + * global/local buffer. + */ + const bool cross; +}; + +void*** partitions; +int global_sum; + +/** + * \param p The buffer to chew. + * \param config The experiment configuration. + * \param len Length of the buffer. + */ +void +chew1(void* pp, config config, size_t len) +{ + int* p = (int*) pp; + const size_t count = len / sizeof(int); + int sum = 0; + posix_rand rand(current_time_millis() ^ gettid()); + if (config.write) { + // Write to the region. + if (config.shuffle) { + // Random access into the memory region. + for (unsigned int c = 0; c < config.nreps; c++) { + for (size_t i = 0; i < count; i++) { + // NOTE: Using r as the index assumes that rand generates large-enough + // values. + int r = rand(); + sum += p[r % count] += r; + } + } + } else { + // Sequential scan through the memory region. + for (unsigned int c = 0; c < config.nreps; c++) { + for (size_t i = 0; i < count; i++) { + sum += p[i] += rand(); + } + } + } + } else { + // Only read from the region. + if (config.shuffle) { + // Random access into the memory region. + for (unsigned int c = 0; c < config.nreps; c++) { + for (size_t i = 0; i < count; i++) { + // NOTE: Using r as the index assumes that rand generates large-enough + // values. + sum += p[rand() % count]; + } + } + } else { + // Sequential scan through the memory region. + for (unsigned int c = 0; c < config.nreps; c++) { + for (size_t i = 0; i < count; i++) { + sum += p[i] + rand(); + } + } + } + } + global_sum += sum; +} + +/** + * \param pp The start of the buffer to chew. + * \param cpu Which CPU to pin our thread to. + * \param config The experiment configuration parameters. + * \param label Prefix for the elapsed time output. + */ +void* +chew(void* pp, unsigned int cpu, const config & config, bool warmup) +{ + // Pin this thread to cpu `cpu`. + if (config.pin) { + pin_thread(cpu); + } + + void* p = config.local ? malloc(config.size) : pp; + timer t(": "); + + if (!warmup && config.cross) { + size_t len = config.size / config.ncores; + for (int i = 0; i < config.ncores; i++) { + partitions[cpu][i] = new char[len]; + } + int barrier_result = pthread_barrier_wait(&cross_barrier); + check(barrier_result == PTHREAD_BARRIER_SERIAL_THREAD || barrier_result == 0); + // TODO: make this more interesting than just a sequential traversal over + // the partitions. + for (int i = 0; i < config.ncores; i++) { + chew1(partitions[i][cpu], config, len); + } + } else { + chew1(p, config, config.size); + } + + // Print the elapsed time and "result". + if (warmup) cout << "warmup: "; + cout << cpu; + t.print(); + + if (config.local) free(p); + + return NULL; +} + +int +main(int argc, char** argv) +{ + // So that our global shared malloc takes place on the CPU 0's node. + pin_thread(0); + + if (argc < 10) { + cerr << argv[0] << + " <ncores> <size> <nreps> <shuffle> <par> <pin> <local> <write>" << endl; + return 1; + } + + // Parse command-line arguments. TODO + const config config = { + atoi(argv[1]), + atoi(argv[2]), + atoi(argv[3]), + atoi(argv[4]), + atoi(argv[5]), + atoi(argv[6]), + atoi(argv[7]), + atoi(argv[8]), + atoi(argv[9]) + }; + + cout << "config:" + << " ncores " << config.ncores + << " size " << config.size + << " nreps " << config.nreps + << " shuffle " << config.shuffle + << " par " << config.par + << " pin " << config.pin + << " local " << config.local + << " write " << config.write + << " cross " << config.cross << endl; + + checkmsg(RAND_MAX > config.size / sizeof(int), "PRNG range not large enough"); + + void *p = malloc(config.size); + check(p != NULL); + + if (config.cross) { + partitions = new void**[config.ncores]; + for (unsigned int i = 0; i < config.ncores; i++) + partitions[i] = new void*[config.ncores]; + } + + // Warmup. + chew(p, 0, config, true); + + if (config.par) { + // Chew the memory area from each core in parallel (and also chew own). + pthread_t ts[config.ncores]; + check(0 == pthread_barrier_init(&cross_barrier, NULL, config.ncores)); + for (int i = 0; i < config.ncores; i++) { + ts[i] = spawn(bind(chew, p, i, ref(config), false)); + } + for (int i = 0; i < config.ncores; i++) { + check(pthread_join(ts[i], NULL) == 0); + } + check(0 == pthread_barrier_destroy(&cross_barrier)); + } else { + // Chew the memory area from each core in sequence. + for (int i = 0; i < config.ncores; i++) { + chew(p, i, config, false); + } + } + + free(p); + ofstream trash("/dev/null"); + trash << "result: " << global_sum << endl; + + return 0; +} Deleted: numa-bench/trunk/src/malloc.bash =================================================================== --- numa-bench/trunk/src/malloc.bash 2008-02-26 19:41:17 UTC (rev 512) +++ numa-bench/trunk/src/malloc.bash 2008-02-26 19:48:37 UTC (rev 513) @@ -1,43 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -o nounset - -make -s malloc-opt - -function run { - for i in {1..3} - do out/malloc-opt "$@" - done -} - -KB=000 MB=000000 GB=000000000 - -# ncores size nreps shuffle par pin local write cross - -echo writes -run 16 100$MB 1 0 0 1 0 1 0 -run 16 1000$MB 1 0 0 1 0 1 0 -run 16 100$MB 10 0 0 1 0 1 0 -run 16 100$MB 1 1 0 1 0 1 0 - -echo reads -run 16 1000$MB 1 0 0 1 0 0 0 -run 16 100$MB 1 1 0 1 0 0 0 - -for n in 1 2 4 8 12 16 ; do - echo par - run $n 10$MB 1 0 1 1 0 0 0 - run $n 10$MB 1 1 1 1 0 0 0 - run $n 10$MB 1 0 1 1 1 0 0 - run $n 10$MB 1 1 1 1 1 0 0 - run $n 10$MB 1 0 1 1 0 1 0 - run $n 10$MB 1 1 1 1 0 1 0 - run $n 10$MB 1 0 1 1 1 1 0 - run $n 10$MB 1 1 1 1 1 1 0 - - echo cross - run $n 10$MB 1 0 1 1 0 0 1 - run $n 10$MB 1 1 1 1 0 0 1 - run $n 10$MB 1 0 1 1 0 1 1 - run $n 10$MB 1 1 1 1 0 1 1 -done Deleted: numa-bench/trunk/src/malloc.cc =================================================================== --- numa-bench/trunk/src/malloc.cc 2008-02-26 19:41:17 UTC (rev 512) +++ numa-bench/trunk/src/malloc.cc 2008-02-26 19:48:37 UTC (rev 513) @@ -1,246 +0,0 @@ -#include <fstream> -#include <iostream> - -#include <sched.h> - -#include <boost/bind.hpp> - -#include <commons/check.h> -#include <commons/rand.h> -#include <commons/threads.h> -#include <commons/time.h> -#include <commons/boost/threads.h> - -using namespace boost; -using namespace commons; -using namespace std; - -pthread_barrier_t cross_barrier; - -struct config -{ - /** - * The number of cores to test. This is a parameter (rather than - * auto-detected) because it additionally serves to mean the number of cores - * we want to test in parallel. As this program evolves, these may be - * separated. - */ - const int ncores; - - /** - * Size in bytes of the buffer to chew. - */ - const size_t size; - - /** - * Number of repetitions to chew. - */ - const int nreps; - - /** - * Perform rand access, otherwise sequential scan. - */ - const bool shuffle; - - /** - * Chew in parallel, otherwise each core chews serially. - */ - const bool par; - - /** - * Pin thread i to core i, otherwise let the OS manage things. - */ - const bool pin; - - /** - * Chew my own memory, otherwise chew the given (shared) memory. - */ - const bool local; - - /** - * Do writes, otherwise just do reads. - */ - const bool write; - - /** - * Test cross-communication (use partitions), otherwise use either the - * global/local buffer. - */ - const bool cross; -}; - -void*** partitions; -int global_sum; - -/** - * \param p The buffer to chew. - * \param config The experiment configuration. - * \param len Length of the buffer. - */ -void -chew1(void* pp, config config, size_t len) -{ - int* p = (int*) pp; - const size_t count = len / sizeof(int); - int sum = 0; - posix_rand rand(current_time_millis() ^ gettid()); - if (config.write) { - // Write to the region. - if (config.shuffle) { - // Random access into the memory region. - for (unsigned int c = 0; c < config.nreps; c++) { - for (size_t i = 0; i < count; i++) { - // NOTE: Using r as the index assumes that rand generates large-enough - // values. - int r = rand(); - sum += p[r % count] += r; - } - } - } else { - // Sequential scan through the memory region. - for (unsigned int c = 0; c < config.nreps; c++) { - for (size_t i = 0; i < count; i++) { - sum += p[i] += rand(); - } - } - } - } else { - // Only read from the region. - if (config.shuffle) { - // Random access into the memory region. - for (unsigned int c = 0; c < config.nreps; c++) { - for (size_t i = 0; i < count; i++) { - // NOTE: Using r as the index assumes that rand generates large-enough - // values. - sum += p[rand() % count]; - } - } - } else { - // Sequential scan through the memory region. - for (unsigned int c = 0; c < config.nreps; c++) { - for (size_t i = 0; i < count; i++) { - sum += p[i] + rand(); - } - } - } - } - global_sum += sum; -} - -/** - * \param pp The start of the buffer to chew. - * \param cpu Which CPU to pin our thread to. - * \param config The experiment configuration parameters. - * \param label Prefix for the elapsed time output. - */ -void* -chew(void* pp, unsigned int cpu, const config & config, bool warmup) -{ - // Pin this thread to cpu `cpu`. - if (config.pin) { - pin_thread(cpu); - } - - void* p = config.local ? malloc(config.size) : pp; - timer t(": "); - - if (!warmup && config.cross) { - size_t len = config.size / config.ncores; - for (int i = 0; i < config.ncores; i++) { - partitions[cpu][i] = new char[len]; - } - int barrier_result = pthread_barrier_wait(&cross_barrier); - check(barrier_result == PTHREAD_BARRIER_SERIAL_THREAD || barrier_result == 0); - // TODO: make this more interesting than just a sequential traversal over - // the partitions. - for (int i = 0; i < config.ncores; i++) { - chew1(partitions[i][cpu], config, len); - } - } else { - chew1(p, config, config.size); - } - - // Print the elapsed time and "result". - if (warmup) cout << "warmup: "; - cout << cpu; - t.print(); - - if (config.local) free(p); - - return NULL; -} - -int -main(int argc, char** argv) -{ - // So that our global shared malloc takes place on the CPU 0's node. - pin_thread(0); - - if (argc < 10) { - cerr << argv[0] << - " <ncores> <size> <nreps> <shuffle> <par> <pin> <local> <write>" << endl; - return 1; - } - - // Parse command-line arguments. TODO - const config config = { - atoi(argv[1]), - atoi(argv[2]), - atoi(argv[3]), - atoi(argv[4]), - atoi(argv[5]), - atoi(argv[6]), - atoi(argv[7]), - atoi(argv[8]), - atoi(argv[9]) - }; - - cout << "config:" - << " ncores " << config.ncores - << " size " << config.size - << " nreps " << config.nreps - << " shuffle " << config.shuffle - << " par " << config.par - << " pin " << config.pin - << " local " << config.local - << " write " << config.write - << " cross " << config.cross << endl; - - checkmsg(RAND_MAX > config.size / sizeof(int), "PRNG range not large enough"); - - void *p = malloc(config.size); - check(p != NULL); - - if (config.cross) { - partitions = new void**[config.ncores]; - for (unsigned int i = 0; i < config.ncores; i++) - partitions[i] = new void*[config.ncores]; - } - - // Warmup. - chew(p, 0, config, true); - - if (config.par) { - // Chew the memory area from each core in parallel (and also chew own). - pthread_t ts[config.ncores]; - check(0 == pthread_barrier_init(&cross_barrier, NULL, config.ncores)); - for (int i = 0; i < config.ncores; i++) { - ts[i] = spawn(bind(chew, p, i, ref(config), false)); - } - for (int i = 0; i < config.ncores; i++) { - check(pthread_join(ts[i], NULL) == 0); - } - check(0 == pthread_barrier_destroy(&cross_barrier)); - } else { - // Chew the memory area from each core in sequence. - for (int i = 0; i < config.ncores; i++) { - chew(p, i, config, false); - } - } - - free(p); - ofstream trash("/dev/null"); - trash << "result: " << global_sum << endl; - - return 0; -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-26 19:41:20
|
Revision: 512 http://assorted.svn.sourceforge.net/assorted/?rev=512&view=rev Author: yangzhang Date: 2008-02-26 11:41:17 -0800 (Tue, 26 Feb 2008) Log Message: ----------- added custom rng Modified Paths: -------------- numa-bench/trunk/src/malloc.cc Modified: numa-bench/trunk/src/malloc.cc =================================================================== --- numa-bench/trunk/src/malloc.cc 2008-02-26 19:41:06 UTC (rev 511) +++ numa-bench/trunk/src/malloc.cc 2008-02-26 19:41:17 UTC (rev 512) @@ -1,4 +1,3 @@ -#include <cstdlib> #include <fstream> #include <iostream> @@ -7,6 +6,7 @@ #include <boost/bind.hpp> #include <commons/check.h> +#include <commons/rand.h> #include <commons/threads.h> #include <commons/time.h> #include <commons/boost/threads.h> @@ -83,6 +83,7 @@ int* p = (int*) pp; const size_t count = len / sizeof(int); int sum = 0; + posix_rand rand(current_time_millis() ^ gettid()); if (config.write) { // Write to the region. if (config.shuffle) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-26 19:41:07
|
Revision: 511 http://assorted.svn.sourceforge.net/assorted/?rev=511&view=rev Author: yangzhang Date: 2008-02-26 11:41:06 -0800 (Tue, 26 Feb 2008) Log Message: ----------- updated script to use simple-build output path Modified Paths: -------------- numa-bench/trunk/src/malloc.bash Modified: numa-bench/trunk/src/malloc.bash =================================================================== --- numa-bench/trunk/src/malloc.bash 2008-02-26 19:40:47 UTC (rev 510) +++ numa-bench/trunk/src/malloc.bash 2008-02-26 19:41:06 UTC (rev 511) @@ -2,11 +2,11 @@ set -o errexit -o nounset -make -s malloc +make -s malloc-opt function run { for i in {1..3} - do ./malloc "$@" + do out/malloc-opt "$@" done } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-26 19:40:45
|
Revision: 510 http://assorted.svn.sourceforge.net/assorted/?rev=510&view=rev Author: yangzhang Date: 2008-02-26 11:40:47 -0800 (Tue, 26 Feb 2008) Log Message: ----------- added output of simple-build (for josmp) Added Paths: ----------- numa-bench/trunk/src/GNUmakefile Added: numa-bench/trunk/src/GNUmakefile =================================================================== --- numa-bench/trunk/src/GNUmakefile (rev 0) +++ numa-bench/trunk/src/GNUmakefile 2008-02-26 19:40:47 UTC (rev 510) @@ -0,0 +1,370 @@ +OUTDIR := /home/yang/work/assorted/numa-bench/trunk/src/out +SRCDIR := /home/yang/work/assorted/numa-bench/trunk/src +SRCPATH := /home/yang/work/assorted/numa-bench/trunk/src +all: malloc avail +PREFIX_0 := /opt/malloc +BINDIR_0 := $(PREFIX_0)/bin + +LIBS_0 := -lpthread +SRCS_0 := $(SRCDIR)/malloc.cc +ORIGTARGET_0 := malloc +AUTOLIBS_0 := +LANG_0 := cpp +TARGET_0 := malloc-dbg +FLAGS_0 := -g3 + +OBJDIR_0 := $(OUTDIR)/$(TARGET_0)-obj +CFLAGS_0 := $(CFLAGS) $(FLAGS_0) +CXXFLAGS_0 := $(CXXFLAGS) $(FLAGS_0) +CPPFLAGS_0 := $(CPPFLAGS) +LDFLAGS_0 := $(LDFLAGS) $(LIBS_0) $(AUTOLIBS_0) +EXE_0 := $(OUTDIR)/$(TARGET_0) + +OBJS_0 := $(foreach ext, c cc cpp cxx, \ + $(patsubst $(SRCDIR)/%.$(ext), $(OBJDIR_0)/%.o, \ + $(filter %.$(ext), $(SRCS_0)))) + +CC_0 := gcc +CXX_0 := g++ +ifeq ($(LANG_0),c) +COMPILER_0 := $(CC_0) +else +COMPILER_0 := $(CXX_0) +endif + +$(TARGET_0): $(EXE_0) + +$(EXE_0): $(OBJS_0) + $(COMPILER_0) $(LDFLAGS_0) -o $@ $^ + +$(OBJDIR_0)/%.o: $(SRCDIR)/%.c + mkdir -p $(@D) + $(CC_0) $(CPPFLAGS_0) $(CFLAGS_0) -MD -c -o $@ $< + +$(OBJDIR_0)/%.o: $(SRCDIR)/%.cc + mkdir -p $(@D) + $(CXX_0) $(CPPFLAGS_0) $(CXXFLAGS_0) -MD -c -o $@ $< + +$(OBJDIR_0)/%.o: $(SRCDIR)/%.cpp + mkdir -p $(@D) + $(CXX_0) $(CPPFLAGS_0) $(CXXFLAGS_0) -MD -c -o $@ $< + +$(OBJDIR_0)/%.o: $(SRCDIR)/%.cxx + mkdir -p $(@D) + $(CXX_0) $(CPPFLAGS_0) $(CXXFLAGS_0) -MD -c -o $@ $< + +clean-$(TARGET_0): + rm -rf $(OBJDIR_0) $(EXE_0) + +$(ORIGTARGET_0): $(TARGET_0) + +.PHONY: $(ORIGTARGET_0) +PREFIX_1 := /opt/malloc +BINDIR_1 := $(PREFIX_1)/bin + +LIBS_1 := -lpthread +SRCS_1 := $(SRCDIR)/malloc.cc +ORIGTARGET_1 := malloc +AUTOLIBS_1 := +LANG_1 := cpp +TARGET_1 := malloc-opt +FLAGS_1 := -O3 + +OBJDIR_1 := $(OUTDIR)/$(TARGET_1)-obj +CFLAGS_1 := $(CFLAGS) $(FLAGS_1) +CXXFLAGS_1 := $(CXXFLAGS) $(FLAGS_1) +CPPFLAGS_1 := $(CPPFLAGS) +LDFLAGS_1 := $(LDFLAGS) $(LIBS_1) $(AUTOLIBS_1) +EXE_1 := $(OUTDIR)/$(TARGET_1) + +OBJS_1 := $(foreach ext, c cc cpp cxx, \ + $(patsubst $(SRCDIR)/%.$(ext), $(OBJDIR_1)/%.o, \ + $(filter %.$(ext), $(SRCS_1)))) + +CC_1 := gcc +CXX_1 := g++ +ifeq ($(LANG_1),c) +COMPILER_1 := $(CC_1) +else +COMPILER_1 := $(CXX_1) +endif + +$(TARGET_1): $(EXE_1) + +$(EXE_1): $(OBJS_1) + $(COMPILER_1) $(LDFLAGS_1) -o $@ $^ + +$(OBJDIR_1)/%.o: $(SRCDIR)/%.c + mkdir -p $(@D) + $(CC_1) $(CPPFLAGS_1) $(CFLAGS_1) -MD -c -o $@ $< + +$(OBJDIR_1)/%.o: $(SRCDIR)/%.cc + mkdir -p $(@D) + $(CXX_1) $(CPPFLAGS_1) $(CXXFLAGS_1) -MD -c -o $@ $< + +$(OBJDIR_1)/%.o: $(SRCDIR)/%.cpp + mkdir -p $(@D) + $(CXX_1) $(CPPFLAGS_1) $(CXXFLAGS_1) -MD -c -o $@ $< + +$(OBJDIR_1)/%.o: $(SRCDIR)/%.cxx + mkdir -p $(@D) + $(CXX_1) $(CPPFLAGS_1) $(CXXFLAGS_1) -MD -c -o $@ $< + +clean-$(TARGET_1): + rm -rf $(OBJDIR_1) $(EXE_1) + +$(ORIGTARGET_1): $(TARGET_1) + +.PHONY: $(ORIGTARGET_1) +PREFIX_2 := /opt/malloc +BINDIR_2 := $(PREFIX_2)/bin + +LIBS_2 := -lpthread +SRCS_2 := $(SRCDIR)/malloc.cc +ORIGTARGET_2 := malloc +AUTOLIBS_2 := +LANG_2 := cpp +TARGET_2 := malloc-gprof +FLAGS_2 := -pg + +OBJDIR_2 := $(OUTDIR)/$(TARGET_2)-obj +CFLAGS_2 := $(CFLAGS) $(FLAGS_2) +CXXFLAGS_2 := $(CXXFLAGS) $(FLAGS_2) +CPPFLAGS_2 := $(CPPFLAGS) +LDFLAGS_2 := $(LDFLAGS) $(LIBS_2) $(AUTOLIBS_2) +EXE_2 := $(OUTDIR)/$(TARGET_2) + +OBJS_2 := $(foreach ext, c cc cpp cxx, \ + $(patsubst $(SRCDIR)/%.$(ext), $(OBJDIR_2)/%.o, \ + $(filter %.$(ext), $(SRCS_2)))) + +CC_2 := gcc +CXX_2 := g++ +ifeq ($(LANG_2),c) +COMPILER_2 := $(CC_2) +else +COMPILER_2 := $(CXX_2) +endif + +$(TARGET_2): $(EXE_2) + +$(EXE_2): $(OBJS_2) + $(COMPILER_2) $(LDFLAGS_2) -o $@ $^ + +$(OBJDIR_2)/%.o: $(SRCDIR)/%.c + mkdir -p $(@D) + $(CC_2) $(CPPFLAGS_2) $(CFLAGS_2) -MD -c -o $@ $< + +$(OBJDIR_2)/%.o: $(SRCDIR)/%.cc + mkdir -p $(@D) + $(CXX_2) $(CPPFLAGS_2) $(CXXFLAGS_2) -MD -c -o $@ $< + +$(OBJDIR_2)/%.o: $(SRCDIR)/%.cpp + mkdir -p $(@D) + $(CXX_2) $(CPPFLAGS_2) $(CXXFLAGS_2) -MD -c -o $@ $< + +$(OBJDIR_2)/%.o: $(SRCDIR)/%.cxx + mkdir -p $(@D) + $(CXX_2) $(CPPFLAGS_2) $(CXXFLAGS_2) -MD -c -o $@ $< + +clean-$(TARGET_2): + rm -rf $(OBJDIR_2) $(EXE_2) + +$(ORIGTARGET_2): $(TARGET_2) + +.PHONY: $(ORIGTARGET_2) +$(OUTDIR)/.deps: $(shell find $(OUTDIR) -name '*.d' 2> /dev/null || true) + mkdir -p $(OUTDIR) + [ "$^" ] && cat $^ > $@ + +-include $(OUTDIR)/.deps + + + +PREFIX_3 := /opt/avail +BINDIR_3 := $(PREFIX_3)/bin + +LIBS_3 := -lpthread +SRCS_3 := $(SRCDIR)/avail.cc +ORIGTARGET_3 := avail +AUTOLIBS_3 := -lnuma +LANG_3 := cpp +TARGET_3 := avail-dbg +FLAGS_3 := -g3 + +OBJDIR_3 := $(OUTDIR)/$(TARGET_3)-obj +CFLAGS_3 := $(CFLAGS) $(FLAGS_3) +CXXFLAGS_3 := $(CXXFLAGS) $(FLAGS_3) +CPPFLAGS_3 := $(CPPFLAGS) +LDFLAGS_3 := $(LDFLAGS) $(LIBS_3) $(AUTOLIBS_3) +EXE_3 := $(OUTDIR)/$(TARGET_3) + +OBJS_3 := $(foreach ext, c cc cpp cxx, \ + $(patsubst $(SRCDIR)/%.$(ext), $(OBJDIR_3)/%.o, \ + $(filter %.$(ext), $(SRCS_3)))) + +CC_3 := gcc +CXX_3 := g++ +ifeq ($(LANG_3),c) +COMPILER_3 := $(CC_3) +else +COMPILER_3 := $(CXX_3) +endif + +$(TARGET_3): $(EXE_3) + +$(EXE_3): $(OBJS_3) + $(COMPILER_3) $(LDFLAGS_3) -o $@ $^ + +$(OBJDIR_3)/%.o: $(SRCDIR)/%.c + mkdir -p $(@D) + $(CC_3) $(CPPFLAGS_3) $(CFLAGS_3) -MD -c -o $@ $< + +$(OBJDIR_3)/%.o: $(SRCDIR)/%.cc + mkdir -p $(@D) + $(CXX_3) $(CPPFLAGS_3) $(CXXFLAGS_3) -MD -c -o $@ $< + +$(OBJDIR_3)/%.o: $(SRCDIR)/%.cpp + mkdir -p $(@D) + $(CXX_3) $(CPPFLAGS_3) $(CXXFLAGS_3) -MD -c -o $@ $< + +$(OBJDIR_3)/%.o: $(SRCDIR)/%.cxx + mkdir -p $(@D) + $(CXX_3) $(CPPFLAGS_3) $(CXXFLAGS_3) -MD -c -o $@ $< + +clean-$(TARGET_3): + rm -rf $(OBJDIR_3) $(EXE_3) + +$(ORIGTARGET_3): $(TARGET_3) + +.PHONY: $(ORIGTARGET_3) +PREFIX_4 := /opt/avail +BINDIR_4 := $(PREFIX_4)/bin + +LIBS_4 := -lpthread +SRCS_4 := $(SRCDIR)/avail.cc +ORIGTARGET_4 := avail +AUTOLIBS_4 := -lnuma +LANG_4 := cpp +TARGET_4 := avail-opt +FLAGS_4 := -O3 + +OBJDIR_4 := $(OUTDIR)/$(TARGET_4)-obj +CFLAGS_4 := $(CFLAGS) $(FLAGS_4) +CXXFLAGS_4 := $(CXXFLAGS) $(FLAGS_4) +CPPFLAGS_4 := $(CPPFLAGS) +LDFLAGS_4 := $(LDFLAGS) $(LIBS_4) $(AUTOLIBS_4) +EXE_4 := $(OUTDIR)/$(TARGET_4) + +OBJS_4 := $(foreach ext, c cc cpp cxx, \ + $(patsubst $(SRCDIR)/%.$(ext), $(OBJDIR_4)/%.o, \ + $(filter %.$(ext), $(SRCS_4)))) + +CC_4 := gcc +CXX_4 := g++ +ifeq ($(LANG_4),c) +COMPILER_4 := $(CC_4) +else +COMPILER_4 := $(CXX_4) +endif + +$(TARGET_4): $(EXE_4) + +$(EXE_4): $(OBJS_4) + $(COMPILER_4) $(LDFLAGS_4) -o $@ $^ + +$(OBJDIR_4)/%.o: $(SRCDIR)/%.c + mkdir -p $(@D) + $(CC_4) $(CPPFLAGS_4) $(CFLAGS_4) -MD -c -o $@ $< + +$(OBJDIR_4)/%.o: $(SRCDIR)/%.cc + mkdir -p $(@D) + $(CXX_4) $(CPPFLAGS_4) $(CXXFLAGS_4) -MD -c -o $@ $< + +$(OBJDIR_4)/%.o: $(SRCDIR)/%.cpp + mkdir -p $(@D) + $(CXX_4) $(CPPFLAGS_4) $(CXXFLAGS_4) -MD -c -o $@ $< + +$(OBJDIR_4)/%.o: $(SRCDIR)/%.cxx + mkdir -p $(@D) + $(CXX_4) $(CPPFLAGS_4) $(CXXFLAGS_4) -MD -c -o $@ $< + +clean-$(TARGET_4): + rm -rf $(OBJDIR_4) $(EXE_4) + +$(ORIGTARGET_4): $(TARGET_4) + +.PHONY: $(ORIGTARGET_4) +PREFIX_5 := /opt/avail +BINDIR_5 := $(PREFIX_5)/bin + +LIBS_5 := -lpthread +SRCS_5 := $(SRCDIR)/avail.cc +ORIGTARGET_5 := avail +AUTOLIBS_5 := -lnuma +LANG_5 := cpp +TARGET_5 := avail-gprof +FLAGS_5 := -pg + +OBJDIR_5 := $(OUTDIR)/$(TARGET_5)-obj +CFLAGS_5 := $(CFLAGS) $(FLAGS_5) +CXXFLAGS_5 := $(CXXFLAGS) $(FLAGS_5) +CPPFLAGS_5 := $(CPPFLAGS) +LDFLAGS_5 := $(LDFLAGS) $(LIBS_5) $(AUTOLIBS_5) +EXE_5 := $(OUTDIR)/$(TARGET_5) + +OBJS_5 := $(foreach ext, c cc cpp cxx, \ + $(patsubst $(SRCDIR)/%.$(ext), $(OBJDIR_5)/%.o, \ + $(filter %.$(ext), $(SRCS_5)))) + +CC_5 := gcc +CXX_5 := g++ +ifeq ($(LANG_5),c) +COMPILER_5 := $(CC_5) +else +COMPILER_5 := $(CXX_5) +endif + +$(TARGET_5): $(EXE_5) + +$(EXE_5): $(OBJS_5) + $(COMPILER_5) $(LDFLAGS_5) -o $@ $^ + +$(OBJDIR_5)/%.o: $(SRCDIR)/%.c + mkdir -p $(@D) + $(CC_5) $(CPPFLAGS_5) $(CFLAGS_5) -MD -c -o $@ $< + +$(OBJDIR_5)/%.o: $(SRCDIR)/%.cc + mkdir -p $(@D) + $(CXX_5) $(CPPFLAGS_5) $(CXXFLAGS_5) -MD -c -o $@ $< + +$(OBJDIR_5)/%.o: $(SRCDIR)/%.cpp + mkdir -p $(@D) + $(CXX_5) $(CPPFLAGS_5) $(CXXFLAGS_5) -MD -c -o $@ $< + +$(OBJDIR_5)/%.o: $(SRCDIR)/%.cxx + mkdir -p $(@D) + $(CXX_5) $(CPPFLAGS_5) $(CXXFLAGS_5) -MD -c -o $@ $< + +clean-$(TARGET_5): + rm -rf $(OBJDIR_5) $(EXE_5) + +$(ORIGTARGET_5): $(TARGET_5) + +.PHONY: $(ORIGTARGET_5) +$(OUTDIR)/.deps: $(shell find $(OUTDIR) -name '*.d' 2> /dev/null || true) + mkdir -p $(OUTDIR) + [ "$^" ] && cat $^ > $@ + +-include $(OUTDIR)/.deps + + +clean: clean-$(TARGET_2) clean-$(TARGET_3) clean-$(TARGET_0) clean-$(TARGET_5) clean-$(TARGET_1) clean-$(TARGET_4) +clean: + rm -rf $(OUTDIR) +GNUmakefile: /home/yang/work/assorted/numa-bench/trunk/src/build + simple-build +clean-build: + rm GNUmakefile +clean-all: clean clean-build +.PHONY: clean all clean-build clean-all This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-26 08:36:17
|
Revision: 509 http://assorted.svn.sourceforge.net/assorted/?rev=509&view=rev Author: yangzhang Date: 2008-02-26 00:36:09 -0800 (Tue, 26 Feb 2008) Log Message: ----------- experimenting with (most promising) build systems Added Paths: ----------- numa-bench/trunk/src/CMakeLists.txt numa-bench/trunk/src/Jamroot Added: numa-bench/trunk/src/CMakeLists.txt =================================================================== --- numa-bench/trunk/src/CMakeLists.txt (rev 0) +++ numa-bench/trunk/src/CMakeLists.txt 2008-02-26 08:36:09 UTC (rev 509) @@ -0,0 +1,7 @@ +project (numa-bench) + +add_executable (malloc malloc.cc) +target_link_libraries (malloc pthread) + +add_executable (avail avail.cc) +target_link_libraries (avail numa) Added: numa-bench/trunk/src/Jamroot =================================================================== --- numa-bench/trunk/src/Jamroot (rev 0) +++ numa-bench/trunk/src/Jamroot 2008-02-26 08:36:09 UTC (rev 509) @@ -0,0 +1,2 @@ +lib pthread ; +exe malloc : malloc.cc pthread : <toolset>gcc:<cxxflags>-g3 ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-25 07:23:07
|
Revision: 508 http://assorted.svn.sourceforge.net/assorted/?rev=508&view=rev Author: yangzhang Date: 2008-02-24 23:23:08 -0800 (Sun, 24 Feb 2008) Log Message: ----------- added google profiler variant Modified Paths: -------------- simple-build/trunk/src/SimpleBuild.scala Modified: simple-build/trunk/src/SimpleBuild.scala =================================================================== --- simple-build/trunk/src/SimpleBuild.scala 2008-02-25 07:21:03 UTC (rev 507) +++ simple-build/trunk/src/SimpleBuild.scala 2008-02-25 07:23:08 UTC (rev 508) @@ -125,7 +125,7 @@ val lang = ext2lang(srcs(0).s.extension) val template = loadTemplate("cpp") val struct = structs(lang) - val frags = for ((variant,xflags) <- List(("dbg", "-g3"), ("opt", "-O3"), ("gprof", "-pg"))) yield { + val frags = for ((variant,xflags) <- List(("dbg", "-g3"), ("opt", "-O3"), ("pprof", "-lprofiler"), ("gprof", "-pg"))) yield { val hdrs = ( for ((k,v) <- attrs.m.elements ++ List( (YamlStr("origtarget"), target), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-25 07:21:05
|
Revision: 507 http://assorted.svn.sourceforge.net/assorted/?rev=507&view=rev Author: yangzhang Date: 2008-02-24 23:21:03 -0800 (Sun, 24 Feb 2008) Log Message: ----------- added a minimal readme Modified Paths: -------------- nano-httpd/trunk/README Modified: nano-httpd/trunk/README =================================================================== --- nano-httpd/trunk/README 2008-02-25 07:20:01 UTC (rev 506) +++ nano-httpd/trunk/README 2008-02-25 07:21:03 UTC (rev 507) @@ -1 +1,4 @@ -janky little web server +% Absolutely Minimal Web Server +% Yang Zhang + +Nothing much to see here. Was written for a JOSMP demo. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-25 07:19:55
|
Revision: 506 http://assorted.svn.sourceforge.net/assorted/?rev=506&view=rev Author: yangzhang Date: 2008-02-24 23:20:01 -0800 (Sun, 24 Feb 2008) Log Message: ----------- removed buggy header - not what i was expecting! Modified Paths: -------------- scala-commons/trunk/src/Makefile Modified: scala-commons/trunk/src/Makefile =================================================================== --- scala-commons/trunk/src/Makefile 2008-02-25 07:19:27 UTC (rev 505) +++ scala-commons/trunk/src/Makefile 2008-02-25 07:20:01 UTC (rev 506) @@ -25,7 +25,7 @@ $(DOCDIR)/index.html: $(SRCS) mkdir -p $(DOCDIR) - scaladoc -d $(DOCDIR) -linksource -header $(HTMLFRAG)/header.html -bottom $(HTMLFRAG)/google-footer.html $^ + scaladoc -d $(DOCDIR) -linksource $^ publish: doc jar web cp -r $(JAR) $(DOCDIR) $(WEBDIR) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-25 07:19:22
|
Revision: 505 http://assorted.svn.sourceforge.net/assorted/?rev=505&view=rev Author: yangzhang Date: 2008-02-24 23:19:27 -0800 (Sun, 24 Feb 2008) Log Message: ----------- added basename, dirname, extension to Path Modified Paths: -------------- scala-commons/trunk/src/commons/Path.scala Modified: scala-commons/trunk/src/commons/Path.scala =================================================================== --- scala-commons/trunk/src/commons/Path.scala 2008-02-25 07:19:11 UTC (rev 504) +++ scala-commons/trunk/src/commons/Path.scala 2008-02-25 07:19:27 UTC (rev 505) @@ -13,6 +13,10 @@ def /(relpath: String) = if (path.last == sep) path + relpath else path + sep + relpath + + def basename = new File(path).getName + def dirname = new File(path).getPath + def extension = basename split "\\." last } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-25 07:19:16
|
Revision: 504 http://assorted.svn.sourceforge.net/assorted/?rev=504&view=rev Author: yangzhang Date: 2008-02-24 23:19:11 -0800 (Sun, 24 Feb 2008) Log Message: ----------- fixed regression Modified Paths: -------------- scala-commons/trunk/src/commons/Io.scala Modified: scala-commons/trunk/src/commons/Io.scala =================================================================== --- scala-commons/trunk/src/commons/Io.scala 2008-02-25 07:07:25 UTC (rev 503) +++ scala-commons/trunk/src/commons/Io.scala 2008-02-25 07:19:11 UTC (rev 504) @@ -151,6 +151,7 @@ "command failed with exit status " + proc.exitValue + ": " + cmd ) } + out } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-02-25 07:07:22
|
Revision: 503 http://assorted.svn.sourceforge.net/assorted/?rev=503&view=rev Author: yangzhang Date: 2008-02-24 23:07:25 -0800 (Sun, 24 Feb 2008) Log Message: ----------- added a readme Added Paths: ----------- java-reactor/trunk/README Added: java-reactor/trunk/README =================================================================== --- java-reactor/trunk/README (rev 0) +++ java-reactor/trunk/README 2008-02-25 07:07:25 UTC (rev 503) @@ -0,0 +1,52 @@ +% Java Reactor +% Yang Zhang + +Overview +-------- + +This is a completely minimal implementation of a select-based reactor framework +for event-based asynchronous IO programming. The reactor core supports +scheduling of tasks (a la Twisted, asio, etc.). This was written after +witnessing the inefficiency of various other reactor-based implementations - at +least for the very particular environment that is PlanetLab. It also helped us +remove the need for a separate thread for the scheduled executor tasks - these +are run in-line. + +Aside from its simplicity, efficiency, and support for scheduled tasks, it also +has no dependencies. + +Related Work +------------ + +- [Apache Mina]: we originally used this for [SRON], but it lacked efficiency + and scheduled tasks, and also requires at least [slf4j]. + +- [SRON]: The project from which Java Reactor was born. + +[Apache Mina]: http://mina.apache.org/ +[SRON]: https://moo.cmcl.cs.cmu.edu/trac/scaleron +[slf4j]: http://www.slf4j.org/ + +License +------- + +Java Reactor is released under the [GNU GPL3]. + +[GNU GPL3]: http://www.gnu.org/licenses/gpl-3.0.txt + +Links +----- + +- Web site: <http://assorted.sf.net/java-reactor/> +- ROX NIO tutorial: <http://rox-xmlrpc.sourceforge.net/niotut/index.html> + +Contact +------- + +Copyright (C) 2008 [Yang Zhang]. +All rights reserved. + +Back to [assorted.sf.net]. + +[Yang Zhang]: http://www.mit.edu/~y_z/ +[assorted.sf.net]: http://assorted.sourceforge.net/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |