1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-04-18 21:44:02 +03:00

MCOL-5180 Check CPU vector instructions set in installer and PrimProc on start (#2499)

* Add check for simd acrh support

* Updates

* More polite and detailed error messages

* Updates

* Always true to conditional

Co-authored-by: Leonid Fedorov <leonid.fedorov@mariadb.com>
This commit is contained in:
Andrey Piskunov 2022-08-11 15:28:22 +03:00 committed by GitHub
parent 0174c8ec08
commit c906172bf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 91 additions and 0 deletions

View File

@ -1,4 +1,10 @@
if [ -z $(cat /proc/cpuinfo | grep -E 'sse4_2|neon|asimd' | head -c1) ]; then
echo "error: this machine CPU lacks of support for Intel SSE4.2 or ARM Advanced SIMD instructions.
Columnstore requires one of this instruction sets, installation aborted"
exit 1
fi
if [ "$1" == "2" ]; then
/bin/cp -f /etc/columnstore/storagemanager.cnf /etc/columnstore/storagemanager.cnf.rpmsave > /dev/null 2>&1
columnstore-pre-uninstall

View File

@ -0,0 +1,11 @@
#!/bin/bash
set -e
# Check for sse4.2 or neon support
if [ -z $(cat /proc/cpuinfo | grep -E 'sse4_2|neon|asimd' | head -c1) ]; then
echo "error: this machine CPU lacks of support for Intel SSE4.2 or ARM Advanced SIMD instructions.
Columnstore requires one of this instruction sets, installation aborted"
exit 1
fi

View File

@ -0,0 +1,66 @@
/* Copyright (C) 2022 MariaDB Corporation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#pragma once
#include <iostream>
#ifdef __aarch64__
#include <sys/auxv.h>
#include <asm/hwcap.h>
#endif
namespace archcheck
{
enum class arcitecture
{
DEFAULT = 0,
SSE4_2 = 1,
ASIMD = 2,
UNKNOWN = -1
};
#if defined(__x86_64__)
__attribute__ ((target ("default")))
arcitecture checkArchitecture()
{
// The default version.
return arcitecture::DEFAULT;
}
__attribute__ ((target ("sse4.2")))
arcitecture checkArchitecture ()
{
// version for SSE4.2
return arcitecture::SSE4_2;
}
#elif defined(__aarch64__)
arcitecture checkArchitecture()
{
// version for arm
if ((getauxval(AT_HWCAP) & HWCAP_ASIMD) != 0)
return arcitecture::ASIMD;
return arcitecture::DEFAULT;
}
#else
arcitecture checkArchitecture()
{
return arcitecture::UNKNOWN;
}
#endif
}

View File

@ -59,6 +59,9 @@ using namespace logging;
#include "umsocketselector.h"
using namespace primitiveprocessor;
#include "archcheck.h"
using namespace archcheck;
#include "liboamcpp.h"
using namespace oam;
@ -735,6 +738,11 @@ int ServicePrimProc::Child()
int main(int argc, char** argv)
{
if (checkArchitecture() != arcitecture::SSE4_2 && checkArchitecture() != arcitecture::ASIMD)
{
std::cerr << "Unsupported CPU architecture. ARM Advanced SIMD or x86_64 SSE4.2 required; aborting. \n";
return 1;
}
Opt opt(argc, argv);
// Set locale language