-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PerfProfiler can now execute Rust code
- Loading branch information
1 parent
472c663
commit cba3c32
Showing
12 changed files
with
168 additions
and
25 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use chela::*; | ||
use std::env; | ||
use std::time::Instant; | ||
|
||
|
||
fn profile(size: usize) -> u128 { | ||
let mut tensor = Tensor::zeros(size); | ||
|
||
let now = Instant::now(); | ||
tensor.fill(5_f32); | ||
now.elapsed().as_nanos() | ||
} | ||
|
||
fn main() { | ||
let args: Vec<String> = env::args().collect(); | ||
let size = args[1].parse::<usize>().unwrap(); | ||
|
||
println!("{}", profile(size)); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use chela::*; | ||
use std::env; | ||
use std::time::Instant; | ||
|
||
|
||
fn profile(size: usize) -> u128 { | ||
let mut tensor = Tensor::zeros(size); | ||
|
||
let now = Instant::now(); | ||
tensor.fill_naive(5_f32); | ||
now.elapsed().as_nanos() | ||
} | ||
|
||
fn main() { | ||
let args: Vec<String> = env::args().collect(); | ||
let size = args[1].parse::<usize>().unwrap(); | ||
|
||
println!("{}", profile(size)); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .suite import TimingSuite | ||
from .profile import measure_performance | ||
from .plot import plot_results | ||
from .suite import * | ||
from .profile import * | ||
from .plot import * |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,23 @@ | ||
import subprocess | ||
import json | ||
|
||
|
||
def merge_dicts(list_of_dicts): | ||
result = {} | ||
for k in list_of_dicts[0].keys(): | ||
result[k] = [d[k] for d in list_of_dicts] | ||
return result | ||
|
||
|
||
def compile_rust(target: str) -> str: | ||
out = subprocess.check_output(f"$HOME/.cargo/bin/cargo build --release --bin {target} " | ||
"-v --message-format=json", shell=True) | ||
out = out.split(b"\n")[-3] | ||
return json.loads(out)["executable"] | ||
|
||
|
||
def get_method_class(method) -> str: | ||
return method.__qualname__.split(".")[0] | ||
|
||
|
||
__all__ = ["merge_dicts", "compile_rust", "get_method_class"] |
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
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
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