forked from exaloop/codon
-
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.
* Upgrade to LLVM 15 (WIP) * Call `setPresplitCoroutine()` on coro LLVM funcs * Use new pass manager * Update deps * Update docs * Fix exceptions on M1 * Add libunwind * Use Orc and JITLink for "codon run" * JITLink integration * Fix callback * Fix strbuf, fix GC root registration * Fix test init * Fix llvm function * Fix pickle, float atomics * Add TargetLibraryAnalysis * Use new LLVM pass manager in GPU codegen * Fix libunwind linking * Fix libunwind * Fix GPU passes * Don't link libunwind explicitly * Bump version * Update plugins for new pass manager * Fix bash error * Fix GPU GV extraction * Move simd module to experimental folder * Update file read * Add benchmark programs * Add dynamic tuple * Fix parser tuple slicing bug * Make DynamicTuple interoperable with Tuple * Fix DynamicTuple GPU interop * Dockerize builds * Simplify CMake * Revert "Simplify CMake" This reverts commit 08d2920. Co-authored-by: Ibrahim Numanagić <[email protected]>
- Loading branch information
Showing
74 changed files
with
3,092 additions
and
7,593 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,55 @@ | ||
from math import sin, cos, sqrt | ||
from time import time | ||
|
||
POINTS = 10000000 | ||
|
||
|
||
class Point: | ||
x: float | ||
y: float | ||
z: float | ||
|
||
def __init__(self, i): | ||
self.x = x = sin(i) | ||
self.y = cos(i) * 3 | ||
self.z = (x * x) / 2 | ||
|
||
def __repr__(self): | ||
return f"<Point: x={self.x}, y={self.y}, z={self.z}>" | ||
|
||
def normalize(self): | ||
x = self.x | ||
y = self.y | ||
z = self.z | ||
norm = sqrt(x * x + y * y + z * z) | ||
self.x /= norm | ||
self.y /= norm | ||
self.z /= norm | ||
|
||
def maximize(self, other): | ||
self.x = self.x if self.x > other.x else other.x | ||
self.y = self.y if self.y > other.y else other.y | ||
self.z = self.z if self.z > other.z else other.z | ||
return self | ||
|
||
|
||
def maximize(points): | ||
next = points[0] | ||
for p in points[1:]: | ||
next = next.maximize(p) | ||
return next | ||
|
||
|
||
def benchmark(n): | ||
points = [None] * n | ||
for i in range(n): | ||
points[i] = Point(i) | ||
for p in points: | ||
p.normalize() | ||
return maximize(points) | ||
|
||
|
||
t0 = time() | ||
print(benchmark(POINTS)) | ||
t1 = time() | ||
print(t1 - t0) |
Oops, something went wrong.