/normxcorr/trunk

To get this branch, use:
bzr branch http://suren.me/webbzr/normxcorr/trunk

« back to all changes in this revision

Viewing changes to dict_hw/cmake/parse_cubin.cmake

  • Committer: Suren A. Chilingaryan
  • Date: 2009-12-12 01:38:41 UTC
  • Revision ID: csa@dside.dyndns.org-20091212013841-feih3qa4i28x75j4
Provide stand-alone library

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#  For more information, please see: http://software.sci.utah.edu
 
2
#
 
3
#  The MIT License
 
4
#
 
5
#  Copyright (c) 2007
 
6
#  Scientific Computing and Imaging Institute, University of Utah
 
7
#
 
8
#  License for the specific language governing rights and limitations under
 
9
#  Permission is hereby granted, free of charge, to any person obtaining a
 
10
#  copy of this software and associated documentation files (the "Software"),
 
11
#  to deal in the Software without restriction, including without limitation
 
12
#  the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
13
#  and/or sell copies of the Software, and to permit persons to whom the
 
14
#  Software is furnished to do so, subject to the following conditions:
 
15
#
 
16
#  The above copyright notice and this permission notice shall be included
 
17
#  in all copies or substantial portions of the Software.
 
18
#
 
19
#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 
20
#  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
21
#  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 
22
#  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
23
#  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
24
#  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 
25
#  DEALINGS IN THE SOFTWARE.
 
26
 
 
27
# .cubin Parsing CMake Script
 
28
# Abe Stephens
 
29
# (c) 2007 Scientific Computing and Imaging Institute, University of Utah
 
30
 
 
31
file(READ ${input_file} file_text)
 
32
 
 
33
if (${file_text} MATCHES ".+")
 
34
 
 
35
  # Remember, four backslashes is escaped to one backslash in the string.
 
36
  string(REGEX REPLACE ";" "\\\\;" file_text ${file_text})
 
37
  string(REGEX REPLACE "\ncode" ";code" file_text ${file_text})
 
38
 
 
39
  list(LENGTH file_text len)
 
40
 
 
41
  foreach(line ${file_text})
 
42
 
 
43
    # Only look at "code { }" blocks.
 
44
    if(line MATCHES "^code")
 
45
 
 
46
      # Break into individual lines.
 
47
      string(REGEX REPLACE "\n" ";" line ${line})
 
48
 
 
49
      foreach(entry ${line})
 
50
 
 
51
        # Extract kernel names.
 
52
        if (${entry} MATCHES "[^g]name = ([^ ]+)")
 
53
          string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry})
 
54
 
 
55
          # Check to see if the kernel name starts with "_"
 
56
          set(skip FALSE)
 
57
          # if (${entry} MATCHES "^_")
 
58
            # Skip the rest of this block.
 
59
            # message("Skipping ${entry}")
 
60
            # set(skip TRUE)
 
61
          # else (${entry} MATCHES "^_")
 
62
            message("Kernel:    ${entry}")
 
63
          # endif (${entry} MATCHES "^_")
 
64
 
 
65
        endif(${entry} MATCHES "[^g]name = ([^ ]+)")
 
66
 
 
67
        # Skip the rest of the block if necessary
 
68
        if(NOT skip)
 
69
 
 
70
          # Registers
 
71
          if (${entry} MATCHES "reg = ([^ ]+)")
 
72
            string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry})
 
73
            message("Registers: ${entry}")
 
74
          endif(${entry} MATCHES "reg = ([^ ]+)")
 
75
 
 
76
          # Local memory
 
77
          if (${entry} MATCHES "lmem = ([^ ]+)")
 
78
            string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry})
 
79
            message("Local:     ${entry}")
 
80
          endif(${entry} MATCHES "lmem = ([^ ]+)")
 
81
 
 
82
          # Shared memory
 
83
          if (${entry} MATCHES "smem = ([^ ]+)")
 
84
            string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry})
 
85
            message("Shared:    ${entry}")
 
86
          endif(${entry} MATCHES "smem = ([^ ]+)")
 
87
 
 
88
          if (${entry} MATCHES "^}")
 
89
            message("")
 
90
          endif(${entry} MATCHES "^}")
 
91
 
 
92
        endif(NOT skip)
 
93
 
 
94
 
 
95
      endforeach(entry)
 
96
 
 
97
    endif(line MATCHES "^code")
 
98
 
 
99
  endforeach(line)
 
100
 
 
101
else()
 
102
  # message("FOUND NO DEPENDS")
 
103
endif()
 
104
 
 
105