-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.vc
109 lines (78 loc) · 3.45 KB
/
Makefile.vc
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
#
# MSVC Makefile for OpenCL and CUDA versions.
# By default, OpenCL is built. To build CUDA, run "nmake /f Makefile.vc cuda"
#
# Path to OpenCL toolkit (if compiler cannot find it with default settings)
OPENCLDIR = C:\Program Files (x86)\AMD APP
CPPFLAGS = $(CPPFLAGS) -nologo -c -O2 -DPLATFORM_WIN32 -GS- -W4 -I"$(OPENCLDIR)\include"
CPPFLAGS = $(CPPFLAGS) -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
LINKCMD = cl -nologo -Fm -Fe$@ $**
LINKCMD = $(LINKCMD) /link /DYNAMICBASE:NO
CORECONVCMD = cscript //Nologo create_core.vbs $? $@
#
# CUDA settings
#
NVCC = nvcc
NVCCFLAGS = -DPLATFORM_WIN32 -O2 --compiler-options -GS-,-W4 --linker-options /DYNAMICBASE:NO
# select GPU architectures to generate code. Most of them will generate same code
# so only unique ones (compare .ptx files in temp dir to find out) are enabled.
# NVCCFLAGS = $(NVCCFLAGS) --keep --keep-dir temp
NVCCFLAGS = $(NVCCFLAGS) --generate-code arch=compute_20,code=compute_20
# NVCCFLAGS = $(NVCCFLAGS) --generate-code arch=compute_30,code=compute_30
NVCCFLAGS = $(NVCCFLAGS) --generate-code arch=compute_32,code=compute_32
NVCCFLAGS = $(NVCCFLAGS) --generate-code arch=compute_35,code=compute_35
# NVCCFLAGS = $(NVCCFLAGS) --generate-code arch=compute_50,code=compute_50
# NVCCFLAGS = $(NVCCFLAGS) --generate-code arch=compute_52,code=compute_52
# NVCCFLAGS = $(NVCCFLAGS) --generate-code arch=compute_53,code=compute_53
# MSVC2010 sets this for 64-bit command prompt. If not, define it on MAKE's command line.
!if "$(PLATFORM)" == "X64"
obj = output_w64
all: gfnsvocl_w64.exe gfnsvsim_w64.exe
cuda: gfnsvcuda_w64.exe
gfnsvsim_w64.exe: $(obj)/gfnsvsim.obj
$(LINKCMD)
gfnsvocl_w64.exe: $(obj)/gfnsvocl.obj $(obj)/gsv_ocl.obj
$(LINKCMD) "$(OPENCLDIR)\lib\x86_64\OpenCL.lib" WINMM.LIB
gfnsvocl_w64_init.exe: $(obj)/gfnsvocl_init.obj $(obj)/gsv_ocl.obj
$(LINKCMD) "$(OPENCLDIR)\lib\x86_64\OpenCL.lib" WINMM.LIB
gfnsvcuda_w64.exe: gfnsvCUDA+.cpp
$(NVCC) $(NVCCFLAGS) -x cu -DDEVICE_CUDA -o $@ $**
# By default, NVCC-based simulator is not required, but it can be built to check
# that speed matches MSVC version (i.e. host optimization options are correct).
gfnsvsim_nvcc_w64.exe: gfnsvCUDA+.cpp
$(NVCC) $(NVCCFLAGS) -x cu -DDEVICE_SIMULATION -o $@ $**
!else
obj = output_w32
all: gfnsvocl_w32.exe gfnsvsim_w32.exe
cuda: gfnsvcuda_w32.exe
gfnsvocl_w32.exe: $(obj)/gfnsvocl.obj $(obj)/gsv_ocl.obj
$(LINKCMD) "$(OPENCLDIR)\lib\x86\OpenCL.lib" WINMM.LIB
gfnsvsim_w32.exe: $(obj)/gfnsvsim.obj
$(LINKCMD)
NVCCFLAGS = $(NVCCFLAGS) -m 32
gfnsvcuda_w32.exe: gfnsvCUDA+.cpp
$(NVCC) $(NVCCFLAGS) -x cu -DDEVICE_CUDA -o $@ $**
# By default, NVCC-based simulator is not required, but it can be built to check
# that speed matches MSVC version (i.e. host optimization options are correct).
gfnsvsim_nvcc_w32.exe: gfnsvCUDA+.cpp
$(NVCC) $(NVCCFLAGS) -x cu -DDEVICE_SIMULATION -o $@ $**
!endif
$(obj)/gfnsvsim.obj: gfnsvCUDA+.cpp
$(CC) $(CPPFLAGS) -DDEVICE_SIMULATION -Fo$@ $**
$(obj)/gfnsvocl.obj: gfnsvCUDA+.cpp
$(CC) $(CPPFLAGS) -DDEVICE_OPENCL -Fo$@ $**
$(obj)/gfnsvocl_init.obj: gfnsvCUDA+.cpp
$(CC) $(CPPFLAGS) -DDEVICE_OPENCL -DINIT_MODE -Fo$@ $**
$(obj)/gsv_ocl.obj: gsv_ocl.cpp core_63.tmp core_64.tmp core_79.tmp
$(CC) $(CPPFLAGS) -Fo$@ gsv_ocl.cpp
core_63.tmp: ocl_core_63.cl
$(CORECONVCMD)
core_64.tmp: ocl_core_64.cl
$(CORECONVCMD)
core_79.tmp: ocl_core_79.cl
$(CORECONVCMD)
clean:
-if exist $(obj)\*.obj del $(obj)\*.obj
-if exist *.map del *.map
-if exist *.exe del *.exe
-if exist *.tmp del *.tmp