This file contains hidden or 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 bash | |
| # Kill all open things except iTerm2 | |
| osascript \ | |
| -e 'tell application "System Events" to set quitapps to name of every application process whose background only is false and name is not "iTerm2"' \ | |
| -e 'repeat with appName in quitapps' \ | |
| -e 'try' \ | |
| -e 'quit application appName' \ | |
| -e 'end try' \ | |
| -e 'end repeat'; \ |
This file contains hidden or 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
| trait RustyIterator(Copyable, Movable): | |
| alias Element: Copyable & Movable | |
| fn next(mut self) -> Optional[Self.Element]: | |
| ... | |
| @fieldwise_init | |
| struct OwningIterator(RustyIterator): | |
| alias Element = Int |
This file contains hidden or 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
| # Parasail commit: 600fb261 (v2.6.2) | |
| # Ish commit: 5090c3e (v1.3.0) | |
| # Capping parasail threads to 16, to match ish which can only use physical cores (mojo bug), so both use 16 threads | |
| # SSE | |
| time ./apps/parasail_aligner -a sg_striped_sse41_128_16 -X 2 -x -M 2 -o 3 -e 1 -d -t 1 -q ./patterns.fa -f /srv/refdata/chm13v2.0.fa -v -V | |
| --> 1m21.371s | |
| time ./apps/parasail_aligner -a sg_dx_striped_sse41_128_16 -X 2 -x -M 2 -o 3 -e 1 -d -t 1 -q ./patterns.fa -f /srv/refdata/chm13v2.0.fa -v -V | |
| --> 1m20.438s | |
| time ./apps/parasail_aligner -a sg_dx_striped_sse41_128_16 -X 2 -x -M 2 -o 3 -e 1 -d -t 16 -q ./patterns.fa -f /srv/refdata/chm13v2.0.fa -v -V |
This file contains hidden or 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
| """Example usage of DelimReader on World Cities Pop. | |
| Deps: | |
| - pixi add extramojo (this example uses v0.15.0) | |
| - mojo 25.4 | |
| Data: | |
| - https://github.com/BurntSushi/rust-csv/blob/master/examples/data/bench/worldcitiespop.csv | |
| - cat worldcitiespop.csv | cut -f6,7 -d, | tail -n +2 > lat_long.csv |
This file contains hidden or 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
| @export | |
| @no_inline | |
| fn compare[ | |
| dtype: DType, width: Int | |
| ]( | |
| read lhs: List[Scalar[dtype]], | |
| read rhs: List[Scalar[dtype]], | |
| mut result: List[Scalar[dtype]], | |
| ): | |
| @parameter |
This file contains hidden or 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
| import math | |
| from algorithm import vectorize | |
| from benchmark import ( | |
| Bench, | |
| Bencher, | |
| BenchId, | |
| BenchMetric, | |
| ThroughputMeasure, | |
| keep, |
This file contains hidden or 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
| import math | |
| from algorithm import vectorize | |
| from bit import pop_count | |
| from memory import pack_bits | |
| from sys import simdwidthof | |
| alias U8_SIMD_WIDTH = simdwidthof[DType.uint8]() | |
| """Get the HW SIMD register size for uint8""" |
This file contains hidden or 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
| from memory import UnsafePointer | |
| from os import abort | |
| @value | |
| struct TreeNode: | |
| var data: String | |
| var key: String | |
| var hash: Int | |
| var left: UnsafePointer[Self] |
This file contains hidden or 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 | |
| set -eo pipefail | |
| # redirect all stdout and stderr to a logfile AND display it on the terminal | |
| exec &> >(tee -a monitor.log) | |
| # pid: Process ID number | |
| # x_pmem: Memory usage as percentage of total system memory (multiplied by 10 (unit conversion between rss and mem_tot)) | |
| # x_vsz: Virtual memory size in KB (allocated memory) |
This file contains hidden or 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
| use std::hash::{BuildHasher, Hasher}; | |
| #[derive(Clone, Copy, Default)] | |
| pub struct SplitMix64Hasher(u64); | |
| impl Hasher for SplitMix64Hasher { | |
| #[inline] | |
| fn finish(&self) -> u64 { | |
| self.0 | |
| } |
NewerOlder