-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSCsub
76 lines (51 loc) · 1.91 KB
/
SCsub
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
#!/usr/bin/env python
import os
Import('env')
Import('env_modules')
cwd = os.getcwd()
env_rwkv = env_modules.Clone()
# get cwd
cenv = os.getcwd()
env_rwkv.add_source_files(env.modules_sources, "./rwkv.cuh/src/cpuops.cpp")
env_rwkv.add_source_files(env.modules_sources, "*.cpp")
if(env["PLATFORM"] != "win32"):
# add rwkv.cuh/src/cpuops.cpp
env_rwkv.Append(CCFLAGS=['-fexceptions'])
# add -march=avx512
print(env["platform"])
if env["platform"] == "linuxbsd":
print("Using linuxbsd")
# add -O3
env_rwkv.Append(CCFLAGS=['-O3'])
# add -march=avx512
env_rwkv.Append(CCFLAGS=['-march=core-avx2'])
# add fast math
env_rwkv.Append(CCFLAGS=['-ffast-math'])
else:
# arm
print(env["platform"])
print(env["arch"])
if env["arch"] == "arm32":
print("arm32")
else:
print("arm64")
env_rwkv.Append(CCFLAGS=['-march=armv8.2-a+bf16'])
# if platform is macos, set it to ignore all warnaserror
if env["platform"] == "macos":
env_rwkv.Append(CCFLAGS=['-Wno-error'])
# add ./rwkv.hpp/include to include path
# get current file location
__file__ = env_rwkv.File('./SCsub').abspath
path = os.path.dirname(os.path.abspath(__file__))
env_rwkv.Append(CPPPATH=[path + "/rwkv.cuh/include"])
else:
env_rwkv.Append(CCFLAGS=['/O2'])
env_rwkv.Append(CCFLAGS=['/EHsc'])
# add ./rwkv.cuh/include to include path
# get current file location in scope of scons
__file__ = env_rwkv.File('./SCsub').abspath
path = os.path.dirname(os.path.abspath(__file__))
env_rwkv.Append(CPPPATH=[path + "/rwkv.cuh/include"])
# set avx512
env_rwkv.Append(CCFLAGS=['/arch:AVX2'])
env_rwkv.add_source_files(env.modules_sources, "*.cpp")