Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
C
compass-github-pull
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
steinbac
compass-github-pull
Commits
919a574d
Commit
919a574d
authored
Apr 30, 2018
by
steinbac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added safe-guard in case L2 cache size not available
parent
1a82d62d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
cmake/FindCPU_FEATURES.cmake
cmake/FindCPU_FEATURES.cmake
+15
-10
No files found.
cmake/FindCPU_FEATURES.cmake
View file @
919a574d
##extract a single line that contains the given pattern (starting from that patter)
##extract a single line that contains the given pattern (starting from that patter)
function
(
extract_line LINESTART_PATTERN MULTILINE_STRING OUTPUT_VARIABLE
)
function
(
extract_line LINESTART_PATTERN MULTILINE_STRING OUTPUT_VARIABLE
)
...
@@ -226,10 +225,10 @@ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
...
@@ -226,10 +225,10 @@ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
ELSEIF
(
CMAKE_SYSTEM_NAME MATCHES
"Windows"
)
ELSEIF
(
CMAKE_SYSTEM_NAME MATCHES
"Windows"
)
#as an alternative to wmic, use
#as an alternative to wmic, use
#get_filename_component(_vendor_id "[HKEY_LOCAL_MACHINE\\Hardware\\Description\\System\\CentralProcessor\\0;VendorIdentifier]" NAME CACHE)
#get_filename_component(_vendor_id "[HKEY_LOCAL_MACHINE\\Hardware\\Description\\System\\CentralProcessor\\0;VendorIdentifier]" NAME CACHE)
#get_filename_component(_cpu_id "[HKEY_LOCAL_MACHINE\\Hardware\\Description\\System\\CentralProcessor\\0;Identifier]" NAME CACHE)
#get_filename_component(_cpu_id "[HKEY_LOCAL_MACHINE\\Hardware\\Description\\System\\CentralProcessor\\0;Identifier]" NAME CACHE)
wmic_get
(
"Name"
MODEL_NAME
)
wmic_get
(
"Name"
MODEL_NAME
)
string
(
STRIP
${
MODEL_NAME
}
MODEL_NAME
)
string
(
STRIP
${
MODEL_NAME
}
MODEL_NAME
)
set
(
CPU_MODEL_NAME
"
${
MODEL_NAME
}
"
CACHE STRING
"cpu model name"
)
set
(
CPU_MODEL_NAME
"
${
MODEL_NAME
}
"
CACHE STRING
"cpu model name"
)
...
@@ -241,19 +240,25 @@ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Windows")
...
@@ -241,19 +240,25 @@ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Windows")
wmic_get
(
"NumberOfCores"
CPU_NPHYS_CORES
)
wmic_get
(
"NumberOfCores"
CPU_NPHYS_CORES
)
#dirty hack that I need to validate with other machines in Win7
#dirty hack that I need to validate with other machines in Win7
if
(
${
CPU_NPHYS_CORES
}
GREATER 1
)
if
(
NOT
"
${
L2_CACHE_SIZE
}
"
STR_EQUAL
""
)
math
(
EXPR L2_CACHE_SIZE
"
${
L2_CACHE_SIZE
}
/
${
CPU_NPHYS_CORES
}
"
)
if
(
${
CPU_NPHYS_CORES
}
GREATER 1
)
math
(
EXPR L2_CACHE_SIZE
"
${
L2_CACHE_SIZE
}
/
${
CPU_NPHYS_CORES
}
"
)
endif
()
set
(
CPU_L2_SIZE_KB
"
${
L2_CACHE_SIZE
}
"
CACHE STRING
"cpu L2 cache size in kB"
)
else
()
message
(
"unable to decipher L2 cache size"
)
endif
()
endif
()
set
(
CPU_L2_SIZE_KB
"0"
CACHE STRING
"cpu L2 cache size in kB"
)
set
(
CPU_L2_SIZE_KB
"
${
L2_CACHE_SIZE
}
"
CACHE STRING
"cpu L2 cache size in kB"
)
set
(
CPU_VENDOR
""
CACHE STRING
"cpu model vendor"
)
set
(
CPU_MODEL_NAME
""
CACHE STRING
"cpu model name"
)
#thanks to the wonderful VC project (https://github.com/VcDevel/Vc)
#thanks to the wonderful VC project (https://github.com/VcDevel/Vc)
include
(
OptimizeForArchitecture
)
include
(
OptimizeForArchitecture
)
OFA_AutodetectHostArchitecture
()
OFA_AutodetectHostArchitecture
()
OFA_HandleX86Options
()
OFA_HandleX86Options
()
list
(
FIND _available_vector_units_list
"sse"
SSE_INDEX
)
list
(
FIND _available_vector_units_list
"sse"
SSE_INDEX
)
list
(
FIND _available_vector_units_list
"sse2"
SSE2_INDEX
)
list
(
FIND _available_vector_units_list
"sse2"
SSE2_INDEX
)
list
(
FIND _available_vector_units_list
"sse3"
SSE3_INDEX
)
list
(
FIND _available_vector_units_list
"sse3"
SSE3_INDEX
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment