mirror of
https://github.com/nasrlol/torque.git
synced 2025-11-27 23:09:21 +01:00
refactor: refactored folder structures and packaging for better clarity
This commit is contained in:
parent
5c90505fe7
commit
356d86e2a9
@ -1,30 +0,0 @@
|
||||
package com.nsrddyn
|
||||
|
||||
import com.nsrddyn.fpu.CholeskyDecomposition
|
||||
import com.nsrddyn.Tests.CholeskyDecompositionTest
|
||||
import java.time.Instant
|
||||
import com.nsrddyn.alu.*
|
||||
import com.nsrddyn.tools.Benchmark
|
||||
|
||||
enum Status:
|
||||
case PASS
|
||||
case FAIL
|
||||
|
||||
|
||||
object Torque extends ZIOAppDefault {
|
||||
|
||||
println("hello world")
|
||||
|
||||
@main def main(args: String*): Unit = { println("\u001b[2J\u001b[H")
|
||||
println("--- TORQUE STRESS TESTING UTILITY ---")
|
||||
|
||||
var tester: CholeskyDecompositionTest = new CholeskyDecompositionTest
|
||||
println(tester.test())
|
||||
|
||||
}
|
||||
|
||||
var p: Prime = new Prime
|
||||
p.run()
|
||||
|
||||
}
|
||||
|
||||
22
src/main/scala/main/Main.scala
Normal file
22
src/main/scala/main/Main.scala
Normal file
@ -0,0 +1,22 @@
|
||||
package main
|
||||
|
||||
import Ops.*
|
||||
import Tests.*
|
||||
import tools.*
|
||||
import java.time.Instant
|
||||
|
||||
object Torque {
|
||||
|
||||
@main
|
||||
def main(args: String*): Unit = { println("\u001b[2J\u001b[H")
|
||||
println("--- TORQUE STRESS TESTING UTILITY ---")
|
||||
|
||||
var cdt: CholeskyDecompositionTest = new CholeskyDecompositionTest
|
||||
// returns an out of bounds error
|
||||
// println(cdt.test())
|
||||
var p: Prime = new Prime
|
||||
p.run(1000000000, true)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
package com.nsrddyn.ops
|
||||
import com.nsrddyn.tools.Benchmark
|
||||
package main.Ops
|
||||
|
||||
import main.tools.Benchmark
|
||||
import main.Traits.*
|
||||
|
||||
import scala.util.hashing
|
||||
import scala.util.hashing.MurmurHash3
|
||||
import com.nsrddyn.Traits.*
|
||||
import scala.math._
|
||||
import scala.collection.immutable.ListSet
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
@ -41,35 +43,8 @@ class Prime() {
|
||||
|
||||
for i <- 0 to n do if isPrime(i) == result then println("true") else println("false")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class PrimeRunner {
|
||||
|
||||
|
||||
def run(threads: Int): Unit = {
|
||||
|
||||
val pr = new Prime()
|
||||
val br = new Benchmark()
|
||||
|
||||
/*
|
||||
* test cases
|
||||
*
|
||||
* 7919 true
|
||||
* 2147483647 false
|
||||
*/
|
||||
|
||||
val time = pr.run(7919, true)
|
||||
println(time)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Hash {
|
||||
|
||||
def run(word: String, loopSize: Int): Unit = {
|
||||
@ -91,7 +66,7 @@ class Hash {
|
||||
*
|
||||
*/
|
||||
|
||||
for i <- 0 to loopSize do MurmurHash3.stringHash(word)
|
||||
for i <- 0 to loopSize do MurmurHash3.stringHash(word)
|
||||
|
||||
}
|
||||
}
|
||||
@ -121,10 +96,10 @@ class CholeskyDecomposition {
|
||||
val lower: ArrayBuffer[ArrayBuffer[Int]] = ArrayBuffer[ArrayBuffer[Int]]()
|
||||
|
||||
for
|
||||
i <- 0 to size
|
||||
j <- 0 until i
|
||||
i <- 0 to size
|
||||
j <- 0 until i
|
||||
do
|
||||
if i == j then lower(i)(j) = getSquaredSummation(lower, i, j, matrix) else lower(j)(j) = getReversedSummation(lower, i, j, matrix)
|
||||
if i == j then lower(i)(j) = getSquaredSummation(lower, i, j, matrix) else lower(j)(j) = getReversedSummation(lower, i, j, matrix)
|
||||
|
||||
}
|
||||
|
||||
@ -1,16 +1,9 @@
|
||||
package com.nsrddyn.Tests
|
||||
package main.Tests
|
||||
|
||||
import com.nsrddyn.fpu.CholeskyDecomposition
|
||||
import scala.collection.immutable.ListSet
|
||||
import zio._
|
||||
import main.Ops.CholeskyDecomposition
|
||||
|
||||
class TestsRunner extends ZIOAppDefault {
|
||||
|
||||
def run =
|
||||
println("Hello world")
|
||||
|
||||
|
||||
}
|
||||
|
||||
class CholeskyDecompositionTest {
|
||||
|
||||
@ -22,7 +15,4 @@ class CholeskyDecompositionTest {
|
||||
println(cdp.run(matrix))
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,4 +1,6 @@
|
||||
package com.nsrddyn.tools
|
||||
package main.tools
|
||||
|
||||
import main.Ops.*
|
||||
|
||||
class Benchmark {
|
||||
/*
|
||||
@ -15,3 +17,26 @@ class Benchmark {
|
||||
// TODO: map this to an actual precision value
|
||||
def measurePrecision(work: => Boolean, expectedResult: Boolean): Unit = if work == expectedResult then println(true) else println(false)
|
||||
}
|
||||
|
||||
|
||||
class PrimeRunner {
|
||||
|
||||
|
||||
def run(threads: Int): Unit = {
|
||||
|
||||
val pr = new Prime()
|
||||
val br = new Benchmark()
|
||||
|
||||
/*
|
||||
* test cases
|
||||
*
|
||||
* 7919 true
|
||||
* 2147483647 false
|
||||
*/
|
||||
|
||||
val time = pr.run(7919, true)
|
||||
println(time)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,10 @@
|
||||
package com.nsrddyn.Traits
|
||||
package main.Traits
|
||||
|
||||
import zio._
|
||||
|
||||
enum Status:
|
||||
case PASS
|
||||
case FAIL
|
||||
|
||||
trait Workload {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user