Skip to content

Instantly share code, notes, and snippets.

View cuviper's full-sized avatar

Josh Stone cuviper

View GitHub Profile
@cuviper
cuviper / MOVED-sdt.rs.txt
Last active August 29, 2015 14:00
Prototype Rust probe!() macro creating SystemTap SDT probes
I'm leaving this gist in place for posterity, but the project now has a home:
https://github.com/cuviper/rust-libprobe
@cuviper
cuviper / systemtap-on-rust
Created January 14, 2015 19:10
SystemTap on Rust. This shows stap tracing function calls and returns for a simple hello.rs. Inspired by @bcantrill's DTrace example (https://gist.github.com/bcantrill/b7d031db6e35cfd79201). For annotated probe points, try https://github.com/cuviper/rust-libprobe.
$ uname -a
Linux laptop 3.10.0-123.13.2.el7.x86_64 #1 SMP Fri Dec 12 19:51:03 EST 2014 x86_64 x86_64 x86_64 GNU/Linux
$ rustc -Vv
rustc 1.0.0-alpha (44a287e6e 2015-01-08 17:03:40 -0800)
binary: rustc
commit-hash: 44a287e6eb22ec3c2a687fc156813577464017f7
commit-date: 2015-01-08 17:03:40 -0800
host: x86_64-unknown-linux-gnu
release: 1.0.0-alpha
$ cat hello.rs
@cuviper
cuviper / rayon-latch-flavors.patch
Created January 1, 2016 10:34
alt latch condvars for nikomatsakis/rayon#9
diff --git a/src/api.rs b/src/api.rs
index 5d7871d5bc06..e122eb4dce16 100644
--- a/src/api.rs
+++ b/src/api.rs
@@ -1,4 +1,4 @@
-use latch::Latch;
+use latch::{ProbingLatch, WaitingLatch};
#[allow(unused_imports)]
use log::Event::*;
use job::{Code, CodeImpl, Job};
@cuviper
cuviper / sieve.rs
Last active March 5, 2016 10:15
Parallel Sieve of Eratosthenes in Rust
extern crate rayon;
extern crate time;
use rayon::prelude::*;
const MAX: usize = 1_000_000_000;
const CHUNK_SIZE: usize = 100_000;
const NUM_PRIMES: usize = 50_847_534;
/// Sieve odd integers for primes up to max (exclusive).

Keybase proof

I hereby claim:

  • I am cuviper on github.
  • I am cuviper (https://keybase.io/cuviper) on keybase.
  • I have a public key whose fingerprint is B863 18F9 8068 DF90 9E2A 0CD8 E3D7 A0D8 ECA9 B2F5

To claim this, I am signing this object:

diff --git a/configure b/configure
index 38f3e3b00c6d..bcb0b0fded8a 100755
--- a/configure
+++ b/configure
@@ -599,6 +599,7 @@ opt debug-assertions 0 "build with debugging assertions"
opt fast-make 0 "use .gitmodules as timestamp for submodule deps"
opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds"
opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
+opt local-rebuild 0 "use an installed rustc matching the current version, for rebuilds"
opt llvm-static-stdcpp 0 "statically link to libstdc++ for LLVM"
@cuviper
cuviper / dyninst-issue50.stp
Created June 3, 2016 01:07
SystemTap script for tracing dyninst #50
/* Run this like:
* stap -v dyninst-issue50.stp -d /lib64/libc.so.6 -d /path/to/libdyninstAPI_RT.so
*
* If you get truncated backtraces, add another -d for that library.
*
* Then run the dyninst test in another terminal like this:
* ./test_driver -test test4_2 -v
*/
private active
use super::IntoParallelIterator;
use super::vec::VecIter;
use std::collections::{BinaryHeap, BTreeMap, BTreeSet, HashMap, HashSet, LinkedList, VecDeque};
macro_rules! vectorized {
( impl<$($c:tt),*> IntoParallelIterator for $t:ty ) => {
impl<$($c),*> IntoParallelIterator for $t
where $t: IntoIterator,
<$t as IntoIterator>::Item: Send
{
@cuviper
cuviper / wip-rayon-find.patch
Last active October 28, 2016 19:59
WIP rayon find
diff --git a/rayon-demo/Cargo.toml b/rayon-demo/Cargo.toml
index 4a5d2697a58c..7d17e8771bf6 100644
--- a/rayon-demo/Cargo.toml
+++ b/rayon-demo/Cargo.toml
@@ -13,3 +13,4 @@ rustc-serialize = "0.3"
time = "0.1"
itertools = "0.4"
num = "0.1.30"
+lazy_static = "0.2.1"
diff --git a/rayon-demo/src/find/mod.rs b/rayon-demo/src/find/mod.rs
@cuviper
cuviper / all-cpus.txt
Last active October 23, 2023 17:25
BabelStream, OpenMP vs. Rayon
$ perf stat -d ./omp-stream
BabelStream
Version: 3.4
Implementation: OpenMP
Running kernels 100 times
Precision: double
Array size: 268.4 MB (=0.3 GB)
Total size: 805.3 MB (=0.8 GB)
Function MBytes/sec Min (sec) Max Average
Copy 108865.244 0.00493 0.05374 0.00834