mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
boost: start
This commit is contained in:
26
README.adoc
26
README.adoc
@@ -1074,7 +1074,7 @@ cd userland/c
|
|||||||
./test
|
./test
|
||||||
....
|
....
|
||||||
|
|
||||||
As mentioned at <<user-mode-tests>>, tests under link:userland/libs[] require certain optional libraries to be installed, and are not built or tested by default.
|
As mentioned at <<userland-libs-directory>>, tests under link:userland/libs[] require certain optional libraries to be installed, and are not built or tested by default.
|
||||||
|
|
||||||
You can install those libraries with:
|
You can install those libraries with:
|
||||||
|
|
||||||
@@ -3737,10 +3737,10 @@ This script skips a manually configured list of tests, notably:
|
|||||||
|
|
||||||
* tests that depend on a full running kernel and cannot be run in user mode simulation, e.g. those that rely on kernel modules
|
* tests that depend on a full running kernel and cannot be run in user mode simulation, e.g. those that rely on kernel modules
|
||||||
* tests that require user interaction
|
* tests that require user interaction
|
||||||
* tests that take perceptible ammounts of time
|
* tests that take perceptible amounts of time
|
||||||
* known bugs we didn't have time to fix ;-)
|
* known bugs we didn't have time to fix ;-)
|
||||||
|
|
||||||
Tests under link:userland/libs/[] depend on certain libraries being available on the target, e.g. <<blas>> for link:userland/libs/openblas[]. They are not run by default, but can be enabled with `--package` and `--package-all`.
|
Tests under link:userland/libs/[] are only run if `--package` or `--package-all` are given as described at <<userland-libs-directory>>.
|
||||||
|
|
||||||
The gem5 tests require building statically with build id `static`, see also: xref:gem5-syscall-emulation-mode[xrefstyle=full]. TODO automate this better.
|
The gem5 tests require building statically with build id `static`, see also: xref:gem5-syscall-emulation-mode[xrefstyle=full]. TODO automate this better.
|
||||||
|
|
||||||
@@ -14807,6 +14807,14 @@ TODO also consider the following:
|
|||||||
* http://www.cs.virginia.edu/stream/ref.html STREAM memory bandwidth benchmarks.
|
* http://www.cs.virginia.edu/stream/ref.html STREAM memory bandwidth benchmarks.
|
||||||
* https://github.com/kozyraki/stamp transactional memory benchmarks
|
* https://github.com/kozyraki/stamp transactional memory benchmarks
|
||||||
|
|
||||||
|
==== Boost
|
||||||
|
|
||||||
|
https://en.wikipedia.org/wiki/Boost_(C%2B%2B_libraries)
|
||||||
|
|
||||||
|
link:userland/libs/boost[]
|
||||||
|
|
||||||
|
* link:userland/libs/boost/bimap.cpp[]
|
||||||
|
|
||||||
==== Dhrystone
|
==== Dhrystone
|
||||||
|
|
||||||
https://en.wikipedia.org/wiki/Dhrystone
|
https://en.wikipedia.org/wiki/Dhrystone
|
||||||
@@ -15100,6 +15108,18 @@ Don't forget to explicitly rebuild PARSEC with:
|
|||||||
You may also want to test if your patches are still functionally correct inside of QEMU first, which is a faster emulator.
|
You may also want to test if your patches are still functionally correct inside of QEMU first, which is a faster emulator.
|
||||||
* sell your soul, and compile natively inside the guest. We won't do this, not only because it is evil, but also because Buildroot explicitly does not support it: https://buildroot.org/downloads/manual/manual.html#faq-no-compiler-on-target ARM employees have been known to do this: https://github.com/arm-university/arm-gem5-rsk/blob/aa3b51b175a0f3b6e75c9c856092ae0c8f2a7cdc/parsec_patches/qemu-patch.diff
|
* sell your soul, and compile natively inside the guest. We won't do this, not only because it is evil, but also because Buildroot explicitly does not support it: https://buildroot.org/downloads/manual/manual.html#faq-no-compiler-on-target ARM employees have been known to do this: https://github.com/arm-university/arm-gem5-rsk/blob/aa3b51b175a0f3b6e75c9c856092ae0c8f2a7cdc/parsec_patches/qemu-patch.diff
|
||||||
|
|
||||||
|
[[userland-libs-directory]]
|
||||||
|
==== userland/libs directory
|
||||||
|
|
||||||
|
Tests under link:userland/libs[] require certain optional libraries to be installed on the target, and are not built or tested by default, you must enable them with either:
|
||||||
|
|
||||||
|
....
|
||||||
|
--package <package>
|
||||||
|
--package-all
|
||||||
|
....
|
||||||
|
|
||||||
|
See for example <<blas>>.
|
||||||
|
|
||||||
=== Userland content bibliography
|
=== Userland content bibliography
|
||||||
|
|
||||||
* The Linux Programming Interface by Michael Kerrisk https://www.amazon.co.uk/Linux-Programming-Interface-System-Handbook/dp/1593272200 Lots of open source POSIX examples: https://github.com/cirosantilli/linux-programming-interface-kerrisk
|
* The Linux Programming Interface by Michael Kerrisk https://www.amazon.co.uk/Linux-Programming-Interface-System-Handbook/dp/1593272200 Lots of open source POSIX examples: https://github.com/cirosantilli/linux-programming-interface-kerrisk
|
||||||
|
|||||||
1
build
1
build
@@ -383,6 +383,7 @@ so looping over all of them would waste time.
|
|||||||
'userland-host': _Component(
|
'userland-host': _Component(
|
||||||
self._build_file('build-userland-in-tree'),
|
self._build_file('build-userland-in-tree'),
|
||||||
apt_get_pkgs={
|
apt_get_pkgs={
|
||||||
|
'libboost-all-dev',
|
||||||
'libdrm-dev',
|
'libdrm-dev',
|
||||||
'libeigen3-dev',
|
'libeigen3-dev',
|
||||||
'libopenblas-dev',
|
'libopenblas-dev',
|
||||||
|
|||||||
@@ -1716,6 +1716,11 @@ https://cirosantilli.com/linux-kernel-module-cheat#gem5-debug-build
|
|||||||
else:
|
else:
|
||||||
eigen_root = self.env['buildroot_staging_dir']
|
eigen_root = self.env['buildroot_staging_dir']
|
||||||
packages = {
|
packages = {
|
||||||
|
'boost': {
|
||||||
|
# Header only, no pkg-config package.
|
||||||
|
'cc_flags': [],
|
||||||
|
'cc_flags_after': [],
|
||||||
|
},
|
||||||
'eigen': {
|
'eigen': {
|
||||||
# TODO: was failing with:
|
# TODO: was failing with:
|
||||||
# fatal error: Eigen/Dense: No such file or directory as of
|
# fatal error: Eigen/Dense: No such file or directory as of
|
||||||
|
|||||||
35
userland/libs/boost/bimap.cpp
Normal file
35
userland/libs/boost/bimap.cpp
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
// https://cirosantilli.com/linux-kernel-module-cheat#boost
|
||||||
|
//
|
||||||
|
// Example adapted from: https://stackoverflow.com/questions/12174997/boostbimap-equivalent-of-bidirectional-multimap/12175238#12175238
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <boost/bimap.hpp>
|
||||||
|
#include <boost/bimap/set_of.hpp>
|
||||||
|
#include <boost/bimap/multiset_of.hpp>
|
||||||
|
|
||||||
|
namespace bimaps = boost::bimaps;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
typedef boost::bimap<bimaps::multiset_of<int>, bimaps::set_of<int>> bimap_t;
|
||||||
|
typedef bimap_t::value_type value_type;
|
||||||
|
bimap_t bimap;
|
||||||
|
bimap.insert(value_type(1, 1));
|
||||||
|
bimap.insert(value_type(1, 2));
|
||||||
|
bimap.insert(value_type(2, 2));
|
||||||
|
auto& left = bimap.left;
|
||||||
|
auto it = left.find(1);
|
||||||
|
std::cout << "LEFT" << std::endl;
|
||||||
|
for (; it != left.end(); ++it)
|
||||||
|
{
|
||||||
|
std::cout << it->first << " " << it->second << std::endl;
|
||||||
|
}
|
||||||
|
auto& right = bimap.right;
|
||||||
|
auto r_it = right.find(2);
|
||||||
|
std::cout << "RIGHT" << std::endl;
|
||||||
|
for (; r_it != right.end(); ++r_it)
|
||||||
|
{
|
||||||
|
std::cout << r_it->first << " " << r_it->second << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
userland/libs/boost/build
Symbolic link
1
userland/libs/boost/build
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../build
|
||||||
1
userland/libs/boost/test
Symbolic link
1
userland/libs/boost/test
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../test
|
||||||
Reference in New Issue
Block a user