initial commit

This commit is contained in:
huangweifeng
2026-10-22 09:23:54 +08:00
commit 63f557a39f
4448 changed files with 584487 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
get_property(EIGEN_TESTS_LIST GLOBAL PROPERTY EIGEN_TESTS_LIST)
configure_file(buildtests.in ${CMAKE_BINARY_DIR}/buildtests.sh @ONLY)
configure_file(check.in ${CMAKE_BINARY_DIR}/check.sh COPYONLY)
configure_file(debug.in ${CMAKE_BINARY_DIR}/debug.sh COPYONLY)
configure_file(release.in ${CMAKE_BINARY_DIR}/release.sh COPYONLY)
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
if [[ $# != 1 || $1 == *help ]]
then
echo "usage: $0 regexp"
echo " Builds tests matching the regexp."
echo " The EIGEN_MAKE_ARGS environment variable allows to pass args to 'make'."
echo " For example, to launch 5 concurrent builds, use EIGEN_MAKE_ARGS='-j5'"
exit 0
fi
TESTSLIST="@EIGEN_TESTS_LIST@"
targets_to_make=$(echo "$TESTSLIST" | grep -E "$1" | xargs echo)
if [ -n "${EIGEN_MAKE_ARGS:+x}" ]
then
@CMAKE_MAKE_PROGRAM@ $targets_to_make ${EIGEN_MAKE_ARGS}
else
@CMAKE_MAKE_PROGRAM@ $targets_to_make @EIGEN_TEST_BUILD_FLAGS@
fi
exit $?
+49
View File
@@ -0,0 +1,49 @@
set(CTEST_SOURCE_DIRECTORY "@CMAKE_SOURCE_DIR@")
set(CTEST_BINARY_DIRECTORY "@CMAKE_BINARY_DIR@")
set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
set(CTEST_BUILD_NAME "@BUILDNAME@")
set(CTEST_SITE "@SITE@")
set(MODEL Experimental)
if(${CTEST_SCRIPT_ARG} MATCHES Nightly)
set(MODEL Nightly)
elseif(${CTEST_SCRIPT_ARG} MATCHES Continuous)
set(MODEL Continuous)
endif()
find_program(CTEST_GIT_COMMAND NAMES git)
set(CTEST_UPDATE_COMMAND "${CTEST_GIT_COMMAND}")
ctest_start(${MODEL} ${CTEST_SOURCE_DIRECTORY} ${CTEST_BINARY_DIRECTORY})
ctest_update(SOURCE "${CTEST_SOURCE_DIRECTORY}")
ctest_submit(PARTS Update Notes)
# to get CTEST_PROJECT_SUBPROJECTS definition:
include("${CTEST_SOURCE_DIRECTORY}/CTestConfig.cmake")
foreach(subproject ${CTEST_PROJECT_SUBPROJECTS})
message("")
message("Process ${subproject}")
set_property(GLOBAL PROPERTY SubProject ${subproject})
set_property(GLOBAL PROPERTY Label ${subproject})
ctest_configure(BUILD ${CTEST_BINARY_DIRECTORY} SOURCE ${CTEST_SOURCE_DIRECTORY} )
ctest_submit(PARTS Configure)
set(CTEST_BUILD_TARGET "Build${subproject}")
message("Build ${CTEST_BUILD_TARGET}")
ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}" APPEND)
# builds target ${CTEST_BUILD_TARGET}
ctest_submit(PARTS Build)
ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" INCLUDE_LABEL "${subproject}" )
# runs only tests that have a LABELS property matching "${subproject}"
ctest_coverage(BUILD "${CTEST_BINARY_DIRECTORY}" LABELS "${subproject}" )
ctest_submit(PARTS Test)
endforeach()
+21
View File
@@ -0,0 +1,21 @@
#!/bin/bash
# check : shorthand for make and ctest -R
if [[ $# != 1 || $1 == *help ]]
then
echo "usage: $0 regexp"
echo " Builds and runs tests matching the regexp."
echo " The EIGEN_MAKE_ARGS environment variable allows to pass args to 'make'."
echo " For example, to launch 5 concurrent builds, use EIGEN_MAKE_ARGS='-j5'"
echo " The EIGEN_CTEST_ARGS environment variable allows to pass args to 'ctest'."
echo " For example, with CTest 2.8, you can use EIGEN_CTEST_ARGS='-j5'."
exit 0
fi
if [ -n "${EIGEN_CTEST_ARGS:+x}" ]
then
./buildtests.sh "$1" && ctest -R "$1" ${EIGEN_CTEST_ARGS}
else
./buildtests.sh "$1" && ctest -R "$1"
fi
exit $?
+65
View File
@@ -0,0 +1,65 @@
# Powershell script to set up MSVC cmake builds that mirror the CI. Useful for reproducing issues.
param ($EIGEN_CI_ROOTDIR,
$EIGEN_CI_BUILDDIR,
$EIGEN_CI_BUILD_TARGET,
$EIGEN_CI_ADDITIONAL_ARGS,
$EIGEN_CI_BEFORE_SCRIPT,
$EIGEN_CI_CMAKE_GENERATOR,
$EIGEN_CI_MSVC_ARCH,
$EIGEN_CI_MSVC_VER,
$EIGEN_CI_TEST_CUSTOM_CXX_FLAGS
)
function Get-ScriptDirectory { Split-Path $MyInvocation.ScriptName }
# Set defaults if not already set.
IF (!$EIGEN_CI_ROOTDIR) { $EIGEN_CI_ROOTDIR = Join-Path (Get-ScriptDirectory) '..' }
IF (!$EIGEN_CI_BUILDDIR) { $EIGEN_CI_BUILDDIR = ".build" }
IF (!$EIGEN_CI_BUILD_TARGET) { $EIGEN_CI_BUILD_TARGET = "buildtests" }
IF (!$EIGEN_CI_ADDITIONAL_ARGS) { $EIGEN_CI_ADDITIONAL_ARGS = "" }
IF (!$EIGEN_CI_BEFORE_SCRIPT) { $EIGEN_CI_BEFORE_SCRIPT = "" }
IF (!$EIGEN_CI_CMAKE_GENERATOR) { $EIGEN_CI_CMAKE_GENERATOR = "Ninja" }
IF (!$EIGEN_CI_MSVC_ARCH) { $EIGEN_CI_MSVC_ARCH = "x64" }
IF (!$EIGEN_CI_MSVC_VER) { $EIGEN_CI_MSVC_VER = "14.29" }
IF (!$EIGEN_CI_TEST_CUSTOM_CXX_FLAGS) { $EIGEN_CI_TEST_CUSTOM_CXX_FLAGS = "/d2ReducedOptimizeHugeFunctions /DEIGEN_STRONG_INLINE=inline /Os" }
# Export variables into the global scope
$global:EIGEN_CI_ROOTDIR = $EIGEN_CI_ROOTDIR
$global:EIGEN_CI_BUILDDIR = $EIGEN_CI_BUILDDIR
$global:EIGEN_CI_BUILD_TARGET = $EIGEN_CI_BUILD_TARGET
$global:EIGEN_CI_ADDITIONAL_ARGS = $EIGEN_CI_ADDITIONAL_ARGS
$global:EIGEN_CI_BEFORE_SCRIPT = $EIGEN_CI_BEFORE_SCRIPT
$global:EIGEN_CI_CMAKE_GENERATOR = $EIGEN_CI_CMAKE_GENERATOR
$global:EIGEN_CI_MSVC_ARCH = $EIGEN_CI_MSVC_ARCH
$global:EIGEN_CI_MSVC_VER = $EIGEN_CI_MSVC_VER
$global:EIGEN_CI_TEST_CUSTOM_CXX_FLAGS = $EIGEN_CI_TEST_CUSTOM_CXX_FLAGS
# Print configuration variables.
Get-Variable | findstr EIGEN
# Run any setup scripts.
if ("${EIGEN_CI_BEFORE_SCRIPT}") { Invoke-Expression -Command "${EIGEN_CI_BEFORE_SCRIPT}" }
# Find Visual Studio installation directory.
$global:VS_INSTALL_DIR = &"${Env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath
# Run VCVarsAll.bat incitialization script and extract environment variables.
# http://allen-mack.blogspot.com/2008/03/replace-visual-studio-command-prompt.html
cmd.exe /c "`"${VS_INSTALL_DIR}\VC\Auxiliary\Build\vcvarsall.bat`" $EIGEN_CI_MSVC_ARCH -vcvars_ver=$EIGEN_CI_MSVC_VER & set" | foreach { if ($_ -match "=") { $v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])" } }
# Create and change to the build directory.
IF (-Not (Test-Path -Path $EIGEN_CI_BUILDDIR) ) { mkdir $EIGEN_CI_BUILDDIR }
cd $EIGEN_CI_BUILDDIR
# We need to split EIGEN_CI_ADDITIONAL_ARGS, otherwise they are interpreted
# as a single argument. Split by space, unless double-quoted.
$split_args = [regex]::Split(${EIGEN_CI_ADDITIONAL_ARGS}, ' (?=(?:[^"]|"[^"]*")*$)' )
cmake -G "${EIGEN_CI_CMAKE_GENERATOR}" -DCMAKE_BUILD_TYPE=MinSizeRel -DEIGEN_TEST_CUSTOM_CXX_FLAGS="${EIGEN_CI_TEST_CUSTOM_CXX_FLAGS}" ${split_args} "${EIGEN_CI_ROOTDIR}"
IF ($EIGEN_CI_BUILD_TARGET) {
# Windows builds sometimes fail due heap errors. In that case, try
# building the rest, then try to build again with a single thread.
cmake --build . --target $EIGEN_CI_BUILD_TARGET -- -k0 || cmake --build . --target $EIGEN_CI_BUILD_TARGET -- -k0 -j1
}
+31
View File
@@ -0,0 +1,31 @@
# Powershell script to set up MSVC CUDA cmake builds that mirror the CI. Useful for reproducing issues.
param ($EIGEN_CI_ROOTDIR,
$EIGEN_CI_BUILDDIR,
$EIGEN_CI_BUILD_TARGET,
$EIGEN_CI_ADDITIONAL_ARGS,
$EIGEN_CI_BEFORE_SCRIPT,
$EIGEN_CI_CMAKE_GENERATOR,
$EIGEN_CI_MSVC_ARCH,
$EIGEN_CI_MSVC_VER,
$EIGEN_CI_TEST_CUSTOM_CXX_FLAGS,
$EIGEN_CI_CUDA_CXX_FLAGS,
$EIGEN_CI_CUDA_COMPUTE_ARCH
)
# Set defaults if not already set.
IF (!$EIGEN_CI_CUDA_CXX_FLAGS) { $EIGEN_CI_CUDA_CXX_FLAGS = "" }
IF (!$EIGEN_CI_CUDA_COMPUTE_ARCH) { $EIGEN_CI_CUDA_COMPUTE_ARCH = "50;70" }
IF (!$EIGEN_CI_BUILD_TARGET) { $EIGEN_CI_BUILD_TARGET = "buildtests_gpu" }
IF (!$EIGEN_CI_ADDITIONAL_ARGS) { $EIGEN_CI_ADDITIONAL_ARGS = '-DCMAKE_CUDA_COMPILER=nvcc.exe -DCMAKE_CUDA_SEPARABLE_COMPILATION=OFF -DEIGEN_TEST_CUDA=on -DEIGEN_CUDA_CXX_FLAGS='+${EIGEN_CI_CUDA_CXX_FLAGS}+' -DEIGEN_CUDA_COMPUTE_ARCH='+${EIGEN_CI_CUDA_COMPUTE_ARCH} }
# Export variables into the global scope
$global:EIGEN_CI_CUDA_CXX_FLAGS = $EIGEN_CI_CUDA_CXX_FLAGS
$global:EIGEN_CI_CUDA_COMPUTE_ARCH = $EIGEN_CI_CUDA_COMPUTE_ARCH
# Call the generic msvc setup scripts.
function Get-ScriptDirectory { Split-Path $MyInvocation.ScriptName }
$script = Join-Path (Get-ScriptDirectory) 'ci_cmake_msvc.ps1'
& $script $EIGEN_CI_ROOTDIR $EIGEN_CI_BUILDDIR $EIGEN_CI_BUILD_TARGET $EIGEN_CI_ADDITIONAL_ARGS $EIGEN_CI_BEFORE_SCRIPT $EIGEN_CI_CMAKE_GENERATOR $EIGEN_CI_MSVC_ARCH $EIGEN_CI_MSVC_VER $EIGEN_CI_TEST_CUSTOM_CXX_FLAGS
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
cmake -DCMAKE_BUILD_TYPE=Debug .
+210
View File
@@ -0,0 +1,210 @@
#include <string>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <map>
#include <list>
using namespace std;
// this function takes a line that may contain a name and/or email address,
// and returns just the name, while fixing the "bad cases".
std::string contributor_name(const std::string& line) {
string result;
// let's first take care of the case of isolated email addresses, like
// "user@localhost.localdomain" entries
if (line.find("markb@localhost.localdomain") != string::npos) {
return "Mark Borgerding";
}
if (line.find("kayhman@contact.intra.cea.fr") != string::npos) {
return "Guillaume Saupin";
}
// from there on we assume that we have a entry of the form
// either:
// Bla bli Blurp
// or:
// Bla bli Blurp <bblurp@email.com>
size_t position_of_email_address = line.find_first_of('<');
if (position_of_email_address != string::npos) {
// there is an e-mail address in <...>.
// Hauke once committed as "John Smith", fix that.
if (line.find("hauke.heibel") != string::npos)
result = "Hauke Heibel";
else {
// just remove the e-mail address
result = line.substr(0, position_of_email_address);
}
} else {
// there is no e-mail address in <...>.
if (line.find("convert-repo") != string::npos)
result = "";
else
result = line;
}
// remove trailing spaces
size_t length = result.length();
while (length >= 1 && result[length - 1] == ' ') result.erase(--length);
return result;
}
// parses hg churn output to generate a contributors map.
map<string, int> contributors_map_from_churn_output(const char* filename) {
map<string, int> contributors_map;
string line;
ifstream churn_out;
churn_out.open(filename, ios::in);
while (!getline(churn_out, line).eof()) {
// remove the histograms "******" that hg churn may draw at the end of some lines
size_t first_star = line.find_first_of('*');
if (first_star != string::npos) line.erase(first_star);
// remove trailing spaces
size_t length = line.length();
while (length >= 1 && line[length - 1] == ' ') line.erase(--length);
// now the last space indicates where the number starts
size_t last_space = line.find_last_of(' ');
// get the number (of changesets or of modified lines for each contributor)
int number;
istringstream(line.substr(last_space + 1)) >> number;
// get the name of the contributor
line.erase(last_space);
string name = contributor_name(line);
map<string, int>::iterator it = contributors_map.find(name);
// if new contributor, insert
if (it == contributors_map.end()) contributors_map.insert(pair<string, int>(name, number));
// if duplicate, just add the number
else
it->second += number;
}
churn_out.close();
return contributors_map;
}
// find the last name, i.e. the last word.
// for "van den Schbling" types of last names, that's not a problem, that's actually what we want.
string lastname(const string& name) {
size_t last_space = name.find_last_of(' ');
if (last_space >= name.length() - 1)
return name;
else
return name.substr(last_space + 1);
}
struct contributor {
string name;
int changedlines;
int changesets;
string url;
string misc;
contributor() : changedlines(0), changesets(0) {}
bool operator<(const contributor& other) { return lastname(name).compare(lastname(other.name)) < 0; }
};
void add_online_info_into_contributors_list(list<contributor>& contributors_list, const char* filename) {
string line;
ifstream online_info;
online_info.open(filename, ios::in);
while (!getline(online_info, line).eof()) {
string hgname, realname, url, misc;
size_t last_bar = line.find_last_of('|');
if (last_bar == string::npos) continue;
if (last_bar < line.length()) misc = line.substr(last_bar + 1);
line.erase(last_bar);
last_bar = line.find_last_of('|');
if (last_bar == string::npos) continue;
if (last_bar < line.length()) url = line.substr(last_bar + 1);
line.erase(last_bar);
last_bar = line.find_last_of('|');
if (last_bar == string::npos) continue;
if (last_bar < line.length()) realname = line.substr(last_bar + 1);
line.erase(last_bar);
hgname = line;
// remove the example line
if (hgname.find("MercurialName") != string::npos) continue;
list<contributor>::iterator it;
for (it = contributors_list.begin(); it != contributors_list.end() && it->name != hgname; ++it) {
}
if (it == contributors_list.end()) {
contributor c;
c.name = realname;
c.url = url;
c.misc = misc;
contributors_list.push_back(c);
} else {
it->name = realname;
it->url = url;
it->misc = misc;
}
}
}
int main() {
// parse the hg churn output files
map<string, int> contributors_map_for_changedlines = contributors_map_from_churn_output("churn-changedlines.out");
// map<string,int> contributors_map_for_changesets = contributors_map_from_churn_output("churn-changesets.out");
// merge into the contributors list
list<contributor> contributors_list;
map<string, int>::iterator it;
for (it = contributors_map_for_changedlines.begin(); it != contributors_map_for_changedlines.end(); ++it) {
contributor c;
c.name = it->first;
c.changedlines = it->second;
c.changesets = 0; // contributors_map_for_changesets.find(it->first)->second;
contributors_list.push_back(c);
}
add_online_info_into_contributors_list(contributors_list, "online-info.out");
contributors_list.sort();
cout << "{| cellpadding=\"5\"\n";
cout << "!\n";
cout << "! Lines changed\n";
cout << "!\n";
list<contributor>::iterator itc;
int i = 0;
for (itc = contributors_list.begin(); itc != contributors_list.end(); ++itc) {
if (itc->name.length() == 0) continue;
if (i % 2)
cout << "|-\n";
else
cout << "|- style=\"background:#FFFFD0\"\n";
if (itc->url.length())
cout << "| [" << itc->url << " " << itc->name << "]\n";
else
cout << "| " << itc->name << "\n";
if (itc->changedlines)
cout << "| " << itc->changedlines << "\n";
else
cout << "| (no information)\n";
cout << "| " << itc->misc << "\n";
i++;
}
cout << "|}" << endl;
}
+24
View File
@@ -0,0 +1,24 @@
#!/bin/sh
# configuration
# You should call this script with USER set as you want, else some default
# will be used
USER=${USER:-'orzel'}
UPLOAD_DIR=dox-devel
#ulimit -v 1024000
# step 1 : build
rm build/doc/html -Rf
mkdir build -p
(cd build && cmake .. && make doc) || { echo "make failed"; exit 1; }
#step 2 : upload
# (the '/' at the end of path is very important, see rsync documentation)
rsync -az --no-p --delete build/doc/html/ $USER@ssh.tuxfamily.org:eigen/eigen.tuxfamily.org-web/htdocs/$UPLOAD_DIR/ || { echo "upload failed"; exit 1; }
#step 3 : fix the perm
ssh $USER@ssh.tuxfamily.org "chmod -R g+w /home/eigen/eigen.tuxfamily.org-web/htdocs/$UPLOAD_DIR" || { echo "perm failed"; exit 1; }
echo "Uploaded successfully"
@@ -0,0 +1,11 @@
#!cmake -P
file(WRITE split_test_helper.h "")
foreach(i RANGE 1 999)
file(APPEND split_test_helper.h
"#if defined(EIGEN_TEST_PART_${i}) || defined(EIGEN_TEST_PART_ALL)\n"
"#define CALL_SUBTEST_${i}(FUNC) CALL_SUBTEST(FUNC)\n"
"#else\n"
"#define CALL_SUBTEST_${i}(FUNC)\n"
"#endif\n\n"
)
endforeach()
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
# This is a script example to automatically update and upload performance unit tests.
# The following five variables must be adjusted to match your settings.
USER='ggael'
UPLOAD_DIR=perf_monitoring/ggaelmacbook26
EIGEN_SOURCE_PATH=$HOME/Eigen/eigen
export PREFIX="haswell-fma"
export CXX_FLAGS="-mfma -w"
####
BENCH_PATH=$EIGEN_SOURCE_PATH/bench/perf_monitoring/$PREFIX
PREVPATH=$(pwd)
cd $EIGEN_SOURCE_PATH/bench/perf_monitoring && ./runall.sh "Haswell 2.6GHz, FMA, Apple's clang" "$@"
cd $PREVPATH || exit 1
ALLFILES="$BENCH_PATH/*.png $BENCH_PATH/*.html $BENCH_PATH/index.html $BENCH_PATH/s1.js $BENCH_PATH/s2.js"
# (the '/' at the end of path is very important, see rsync documentation)
rsync -az --no-p --delete $ALLFILES $USER@ssh.tuxfamily.org:eigen/eigen.tuxfamily.org-web/htdocs/$UPLOAD_DIR/ || { echo "upload failed"; exit 1; }
# fix the perm
ssh $USER@ssh.tuxfamily.org "chmod -R g+w /home/eigen/eigen.tuxfamily.org-web/htdocs/perf_monitoring" || { echo "perm failed"; exit 1; }
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
# Format files with extensions, excluding plugins because they're partial files that don't contain valid syntax
find . -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.cu' -o -name '*.cxx' -o -name '*.h' -o -name '*.inc' -not -path '*/plugins/*' \) | xargs -n 1 -P 0 clang-format-17 -i
# Format main headers without extensions
find Eigen -maxdepth 1 -type f | xargs -n 1 -P 0 clang-format-17 -i
find unsupported/Eigen -maxdepth 2 -type f -not -name '*.txt' | xargs -n 1 -P 0 clang-format-17 -i
# Format examples
find doc/examples -type f -name '*.cpp.*' | xargs -n 1 -P 0 clang-format-17 -i
+21
View File
@@ -0,0 +1,21 @@
# Powershell script to set up MSVC environment.
param ($EIGEN_CI_MSVC_ARCH, $EIGEN_CI_MSVC_VER)
Set-PSDebug -Trace 1
function Get-ScriptDirectory { Split-Path $MyInvocation.ScriptName }
# Set defaults if not already set.
IF (!$EIGEN_CI_MSVC_ARCH) { $EIGEN_CI_MSVC_ARCH = "x64" }
IF (!$EIGEN_CI_MSVC_VER) { $EIGEN_CI_MSVC_VER = "14.29" }
# Export variables into the global scope
$global:EIGEN_CI_MSVC_ARCH = $EIGEN_CI_MSVC_ARCH
$global:EIGEN_CI_MSVC_VER = $EIGEN_CI_MSVC_VER
# Find Visual Studio installation directory.
$global:VS_INSTALL_DIR = &"${Env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath
# Run VCVarsAll.bat incitialization script and extract environment variables.
# http://allen-mack.blogspot.com/2008/03/replace-visual-studio-command-prompt.html
cmd.exe /c "`"${VS_INSTALL_DIR}\VC\Auxiliary\Build\vcvarsall.bat`" $EIGEN_CI_MSVC_ARCH -vcvars_ver=$EIGEN_CI_MSVC_VER & set" | foreach { if ($_ -match "=") { $v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])" } }
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
cmake -DCMAKE_BUILD_TYPE=Release .