-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathnvmexopts_maci64.sh
117 lines (117 loc) · 5.23 KB
/
nvmexopts_maci64.sh
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
#
# mexopts.sh Shell script for configuring MEX-file creation script,
# mex, to use NVCC for building GPU MEX files.
#
# usage: Do not call this file directly; it is sourced by the
# mex shell script. Modify only if you don't like the
# defaults after running mex. No spaces are allowed
# around the '=' in the variable assignment.
#
# Note: For the version of system compiler supported with this release,
# refer to the Supported and Compatible Compiler List at:
# http://www.mathworks.com/support/compilers/current_release/
#
#
# SELECTION_TAGs occur in template option files and are used by MATLAB
# tools, such as mex and mbuild, to determine the purpose of the contents
# of an option file. These tags are only interpreted when preceded by '#'
# and followed by ':'.
#
#SELECTION_TAG_MEX_OPT: Template Options file for building nvcc MEX-files
#
# Copyright 2012 The MathWorks, Inc.
#----------------------------------------------------------------------------
#
TMW_ROOT="$MATLAB"
MFLAGS=''
# Set the value of $NVCC. By default we assume that it's on your path. You
# can explicitly provide the path in an environment variable if that's not
# the case.
if [ -n "$MW_NVCC_PATH" ]; then
NVCC="$MW_NVCC_PATH"
else
NVCC="nvcc"
fi
if [ "$ENTRYPOINT" = "mexLibrary" ]; then
MLIBS="-L$TMW_ROOT/bin/$Arch -lmx -lmex -lmat -lmwservices -lut"
else
MLIBS="-L$TMW_ROOT/bin/$Arch -lmx -lmex -lmat"
fi
case "$Arch" in
Undetermined)
#----------------------------------------------------------------------------
# Change this line if you need to specify the location of the MATLAB
# root directory. The script needs to know where to find utility
# routines so that it can determine the architecture; therefore, this
# assignment needs to be done while the architecture is still
# undetermined.
#----------------------------------------------------------------------------
MATLAB="$MATLAB"
;;
maci64)
#----------------------------------------------------------------------------
# StorageVersion: 1.0
# CkeyName: nvcc
# CkeyManufacturer: NVIDIA
# CkeyLanguage: C
# CkeyVersion:
# CkeyLinkerName:
# CkeyLinkerVersion:
CC="$NVCC"
MW_SDK_TEMP="find /Applications/Xcode.app/Contents/Developer -name MacOSX10.9.sdk"
MW_SDKROOT=`$MW_SDK_TEMP`
MACOSX_DEPLOYMENT_TARGET='10.9'
ARCHS='x86_64'
CFLAGS="-ccbin=/usr/bin/clang++ -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=\\\"sm_30,compute_30\\\" -m 64 -I$TMW_ROOT/toolbox/distcomp/gpu/extern/include -I/usr/include -I/usr/include/c++/4.2.1 --compiler-options -fno-common,-arch,$ARCHS,-isysroot,$MW_SDKROOT,-mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET,-fexceptions,-Dchar16_t=uint16_t,-Dchar32_t=uint32_t"
CLIBS="$MLIBS -L/usr/local/cuda/lib -lmwgpu -lcudart -lcurand"
COPTIMFLAGS='-O3 -DNDEBUG'
CDEBUGFLAGS='-g'
#
# C++keyName: nvcc
# C++keyManufacturer: NVIDIA
# C++keyLanguage: C++
# C++keyVersion:
# C++keyLinkerName:
# C++keyLinkerVersion:
CXX="$NVCC"
CXXFLAGS="-ccbin=/usr/bin/clang++ -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=\\\"sm_30,compute_30\\\" -m 64 -I$TMW_ROOT/toolbox/distcomp/gpu/extern/include -I/usr/include -I/usr/include/c++/4.2.1 --compiler-options -fno-common,-fexceptions,-arch,$ARCHS,-isysroot,$MW_SDKROOT,-mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET,-Dchar16_t=uint16_t,-Dchar32_t=uint32_t"
CXXLIBS="$MLIBS -L/usr/local/cuda/lib -lmwgpu -lcudart -lcurand"
CXXOPTIMFLAGS='-O3 -DNDEBUG'
CXXDEBUGFLAGS='-g'
#
LD="xcrun -sdk macosx10.9 clang"
LDEXTENSION='.mexmaci64'
LDFLAGS="-arch $ARCHS -Wl,-syslibroot,$MW_SDKROOT,-rpath,/usr/local/cuda/lib -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET"
LDFLAGS="$LDFLAGS -bundle -Wl,-exported_symbols_list,$TMW_ROOT/extern/lib/$Arch/$MAPFILE -stdlib=libc++ -L/usr/local/cuda/lib"
LDOPTIMFLAGS='-O'
LDDEBUGFLAGS='-g'
#
POSTLINK_CMDS=':'
#----------------------------------------------------------------------------
;;
esac
#############################################################################
#
# Architecture independent lines:
#
# Set and uncomment any lines which will apply to all architectures.
#
#----------------------------------------------------------------------------
# CC="$CC"
# CFLAGS="$CFLAGS"
# COPTIMFLAGS="$COPTIMFLAGS"
# CDEBUGFLAGS="$CDEBUGFLAGS"
# CLIBS="$CLIBS"
#
# FC="$FC"
# FFLAGS="$FFLAGS"
# FOPTIMFLAGS="$FOPTIMFLAGS"
# FDEBUGFLAGS="$FDEBUGFLAGS"
# FLIBS="$FLIBS"
#
# LD="$LD"
# LDFLAGS="$LDFLAGS"
# LDOPTIMFLAGS="$LDOPTIMFLAGS"
# LDDEBUGFLAGS="$LDDEBUGFLAGS"
#----------------------------------------------------------------------------
#############################################################################