-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathlakefile.lean
More file actions
executable file
·150 lines (111 loc) · 3.13 KB
/
lakefile.lean
File metadata and controls
executable file
·150 lines (111 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import Lake
open Lake DSL System
def linkArgs :=
if System.Platform.isWindows then
#[]
else if System.Platform.isOSX then
#["-L/opt/homebrew/opt/openblas/lib",
"-L/usr/local/opt/openblas/lib", "-lblas"]
else -- assuming linux
#["-L/usr/lib/x86_64-linux-gnu/", "-lblas", "-lm"]
def inclArgs :=
if System.Platform.isWindows then
#[]
else if System.Platform.isOSX then
#["-I/opt/homebrew/opt/openblas/include",
"-I/usr/local/opt/openblas/include"]
else -- assuming linux
#[]
package scilean {
moreLinkArgs := linkArgs
} --
-- require mathlib from git "https://github.com/leanprover-community/mathlib4" @ "v4.19.0"
require leanblas from git "https://github.com/lecopivo/LeanBLAS" @ "master"
-- FFI - build all `*.c` files in `./C` directory and package them into `libscileanc.a/so` library
target libscileanc pkg : FilePath := do
let mut oFiles : Array (Job FilePath) := #[]
for file in (← (pkg.dir / "C").readDir) do
if file.path.extension == some "c" then
let oFile := pkg.buildDir / "c" / (file.fileName.stripSuffix ".c" ++ ".o")
let srcJob ← inputTextFile file.path
let weakArgs := #["-I", (← getLeanIncludeDir).toString]
oFiles := oFiles.push (← buildO oFile srcJob weakArgs #["-fPIC", "-O3", "-DNDEBUG"] "gcc" getLeanTrace)
let name := nameToStaticLib "scileanc"
buildStaticLib (pkg.sharedLibDir / name) oFiles
@[default_target]
lean_lib SciLean {
roots := #[`SciLean]
}
-- Files that should be compiled, either to get fast tactic or to make FFI functions work in editor
lean_lib SciLean.FFI where
precompileModules := true
moreLinkObjs := #[libscileanc]
@[test_driver]
lean_lib Test {
globs := #[Glob.submodules `Test]
}
----------------------------------------------------------------------------------------------------
lean_exe Doodle {
root := `examples.Doodle
}
lean_exe WaveEquation {
root := `examples.WaveEquation
}
lean_exe HelloWorld {
root := `examples.HelloWorld
}
lean_exe HarmonicOscillator {
root := `examples.HarmonicOscillator
}
lean_exe CircleOptimisation {
root := `examples.CircleOptimisation
}
lean_exe Ballistic {
root := `examples.Ballistic
}
lean_exe WalkOnSpheres {
root := `examples.WalkOnSpheres
}
lean_exe BFGS {
root := `Test.optimjl.bfgs
}
lean_exe LBFGS {
root := `Test.optimjl.lbfgs
}
lean_exe GMM {
root := `SciLean.Examples.GMM.Main
}
lean_exe BlasTest {
root := `examples.BlasTest
}
lean_exe FloatTest {
root := `examples.FloatTest
}
lean_exe ForLoopTest {
buildType := .release
moreLinkArgs := #["-O3", "-UNDEBUG"]
root := `tests.sum_speed_test
}
lean_exe SurfaceMeshTests {
root := `examples.SurfaceMeshTests
}
lean_exe FloatMatrixTest {
root := `examples.FloatMatrixTest
}
lean_exe ProfileKMeans {
root := `examples.Profile.KMeans
}
lean_exe ProfileKMeansDirection {
root := `examples.Profile.KMeansDirection
}
lean_exe ProfileTensorOps {
root := `examples.Profile.TensorOps
}
lean_exe ProfileGMM {
root := `examples.Profile.GMM
}
lean_exe ProfileLSTM {
root := `examples.Profile.LSTM
}
lean_exe MNISTClassifier where
root := `examples.MNISTClassifier