Skip to content

Commit eb9391c

Browse files
committed
Init
0 parents  commit eb9391c

File tree

2,201 files changed

+483214
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,201 files changed

+483214
-0
lines changed

CDS_test/CDS_test.sln

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.25420.1
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CDS_test", "CDS_test.vcxproj", "{A532CC77-0CBC-47C0-86BD-EB1BFB67880B}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|x64 = Debug|x64
11+
Debug|x86 = Debug|x86
12+
Release|x64 = Release|x64
13+
Release|x86 = Release|x86
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{A532CC77-0CBC-47C0-86BD-EB1BFB67880B}.Debug|x64.ActiveCfg = Debug|x64
17+
{A532CC77-0CBC-47C0-86BD-EB1BFB67880B}.Debug|x64.Build.0 = Debug|x64
18+
{A532CC77-0CBC-47C0-86BD-EB1BFB67880B}.Debug|x86.ActiveCfg = Debug|Win32
19+
{A532CC77-0CBC-47C0-86BD-EB1BFB67880B}.Debug|x86.Build.0 = Debug|Win32
20+
{A532CC77-0CBC-47C0-86BD-EB1BFB67880B}.Release|x64.ActiveCfg = Release|x64
21+
{A532CC77-0CBC-47C0-86BD-EB1BFB67880B}.Release|x64.Build.0 = Release|x64
22+
{A532CC77-0CBC-47C0-86BD-EB1BFB67880B}.Release|x86.ActiveCfg = Release|Win32
23+
{A532CC77-0CBC-47C0-86BD-EB1BFB67880B}.Release|x86.Build.0 = Release|Win32
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
EndGlobal

CDS_test/CDS_test.vcxproj

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<ProjectGuid>{A532CC77-0CBC-47C0-86BD-EB1BFB67880B}</ProjectGuid>
23+
<RootNamespace>CDS_test</RootNamespace>
24+
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
25+
</PropertyGroup>
26+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
27+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
28+
<ConfigurationType>Application</ConfigurationType>
29+
<UseDebugLibraries>true</UseDebugLibraries>
30+
<PlatformToolset>v140</PlatformToolset>
31+
<CharacterSet>MultiByte</CharacterSet>
32+
</PropertyGroup>
33+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
34+
<ConfigurationType>Application</ConfigurationType>
35+
<UseDebugLibraries>false</UseDebugLibraries>
36+
<PlatformToolset>v140</PlatformToolset>
37+
<WholeProgramOptimization>true</WholeProgramOptimization>
38+
<CharacterSet>MultiByte</CharacterSet>
39+
</PropertyGroup>
40+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
41+
<ConfigurationType>Application</ConfigurationType>
42+
<UseDebugLibraries>true</UseDebugLibraries>
43+
<PlatformToolset>v140</PlatformToolset>
44+
<CharacterSet>MultiByte</CharacterSet>
45+
</PropertyGroup>
46+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
47+
<ConfigurationType>Application</ConfigurationType>
48+
<UseDebugLibraries>false</UseDebugLibraries>
49+
<PlatformToolset>v140</PlatformToolset>
50+
<WholeProgramOptimization>true</WholeProgramOptimization>
51+
<CharacterSet>MultiByte</CharacterSet>
52+
</PropertyGroup>
53+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
54+
<ImportGroup Label="ExtensionSettings">
55+
</ImportGroup>
56+
<ImportGroup Label="Shared">
57+
</ImportGroup>
58+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
59+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
60+
</ImportGroup>
61+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
62+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
63+
</ImportGroup>
64+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
65+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
66+
</ImportGroup>
67+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
68+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
69+
</ImportGroup>
70+
<PropertyGroup Label="UserMacros" />
71+
<PropertyGroup />
72+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
73+
<ClCompile>
74+
<WarningLevel>Level3</WarningLevel>
75+
<Optimization>Disabled</Optimization>
76+
<SDLCheck>true</SDLCheck>
77+
</ClCompile>
78+
</ItemDefinitionGroup>
79+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
80+
<ClCompile>
81+
<WarningLevel>Level3</WarningLevel>
82+
<Optimization>Disabled</Optimization>
83+
<SDLCheck>true</SDLCheck>
84+
</ClCompile>
85+
</ItemDefinitionGroup>
86+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
87+
<ClCompile>
88+
<WarningLevel>Level3</WarningLevel>
89+
<Optimization>MaxSpeed</Optimization>
90+
<FunctionLevelLinking>true</FunctionLevelLinking>
91+
<IntrinsicFunctions>true</IntrinsicFunctions>
92+
<SDLCheck>true</SDLCheck>
93+
</ClCompile>
94+
<Link>
95+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
96+
<OptimizeReferences>true</OptimizeReferences>
97+
</Link>
98+
</ItemDefinitionGroup>
99+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
100+
<ClCompile>
101+
<WarningLevel>Level3</WarningLevel>
102+
<Optimization>MaxSpeed</Optimization>
103+
<FunctionLevelLinking>true</FunctionLevelLinking>
104+
<IntrinsicFunctions>true</IntrinsicFunctions>
105+
<SDLCheck>true</SDLCheck>
106+
<AdditionalIncludeDirectories>libcds</AdditionalIncludeDirectories>
107+
</ClCompile>
108+
<Link>
109+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
110+
<OptimizeReferences>true</OptimizeReferences>
111+
</Link>
112+
</ItemDefinitionGroup>
113+
<ItemGroup>
114+
<Library Include="libcds-amd64-vcv140.lib" />
115+
</ItemGroup>
116+
<ItemGroup>
117+
<ClCompile Include="main.cpp" />
118+
</ItemGroup>
119+
<ItemGroup>
120+
<ClInclude Include="safe_ptr.h" />
121+
</ItemGroup>
122+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
123+
<ImportGroup Label="ExtensionTargets">
124+
</ImportGroup>
125+
</Project>

CDS_test/Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
benchmark : main.o
2+
g++ -lm -pthread -O3 -o benchmark main.o ./libcds/bin/libcds-s.a
3+
4+
5+
gcc = g++ -std=c++14 -pthread -I./libcds -O3 -c
6+
7+
main.o : main.cpp
8+
$(gcc) main.cpp
9+
10+
11+
clean :
12+
rm main.o benchmark

CDS_test/Readme.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
## Benchmark lock-free lib-CDS and `std::map` guarded by contention free shared mutex
2+
3+
Compares:
4+
5+
* `std::mutex + std::map`
6+
* `SkipListMap`
7+
* `BronsonAVLTreeMap`
8+
* `contention_free_shared_mutex<> + std::map`
9+
10+
11+
To build and test do:
12+
13+
```
14+
cd libcds
15+
make
16+
cd ..
17+
make
18+
19+
./bench.sh
20+
```
21+
22+
23+
----
24+
25+
### Results
26+
27+
28+
Performance comparison of different multithread associative arrays on one server-CPU by using different number of threads.
29+
30+
In this benchmarks used this commit of libCDS: https://github.com/khizmax/libcds/tree/5e2a9854b0a8625183818eb8ad91e5511fed5898
31+
32+
Benchmark on Linux (GCC 4.9.2) - **1 x CPU** Intel Xeon E5-2660v3 2.6 GHz (Haswell) 10 Cores (20 HT) - total: 20 Threads
33+
34+
Command line for starting: `numactl --localalloc --cpunodebind=0 ./benchmark 16`
35+
36+
37+
1. **Performance** (the bigger – the better), MOps - millions operations per second
38+
39+
40+
![Performance contention free shared mutex](https://hsto.org/files/2c5/d6c/93b/2c5d6c93b48c464f8c7d2eb2f2254270.png)
41+
42+
43+
44+
2. **Median-latency** (the lower – the better), microseconds
45+
46+
To measure median latency – in the test code main.cpp, you should to set: `const bool measure_latency = true;`
47+
48+
![Latency contention free shared mutex](https://hsto.org/files/299/3f3/904/2993f39048694f9799a520c87dfbd5ac.png)
49+
50+

CDS_test/bench.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#sudo apt-get install numactl
2+
echo ------------------------------- >> bench_cds_log.txt
3+
##date +%F >> bench_cds_log.txt
4+
date +%T >> bench_cds_log.txt
5+
6+
numactl --localalloc --cpunodebind=0 ./benchmark 18 >> bench_cds_log.txt
7+
8+
# ./benchmark >> bench_cds_log.txt

CDS_test/bench_show.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#sudo apt-get install numactl
2+
3+
4+
numactl --localalloc --cpunodebind=0 ./benchmark 18
5+
6+
# ./benchmark

CDS_test/libcds-amd64-vcv140.dll

44 KB
Binary file not shown.

CDS_test/libcds-amd64-vcv140.lib

30.7 KB
Binary file not shown.

CDS_test/libcds/.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/doc
2+
/sandbox
3+
/projects/Win/vc12/cds.opensdf
4+
/projects/Win/vc12/cds.sdf
5+
/projects/Win/vc12/cds.v12.suo
6+
/tests/cppunit/*.o
7+
*.o
8+
*.d
9+
/tests/data/dictionary.txt
10+
/bin
11+
/obj
12+
/projects/Win/vc12/*.user
13+
/projects/Win/vc14/cds.sdf
14+
/projects/Win/vc14/cds.v14.suo
15+
/projects/Win/vc14/*.user
16+
/projects/Win/vc14/*.opensdf
17+
/projects/Win/vc14/.vs/
18+
/todo-2.1.txt
19+
*.log
20+
/.project
21+
/projects/Win/vc14/*.opendb
22+
/test/stress/data/dictionary.txt
23+
/projects/Win/vc14/cds.VC.db
24+
/todo-2.2.txt
25+
/build/Makefile
26+
/build/build.sh
27+
/build/sample

CDS_test/libcds/.travis.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
language: cpp
3+
compiler: g++
4+
# - gcc
5+
# - clang
6+
7+
before_install:
8+
- export LIBCDS_BUILD_DIR=`pwd`
9+
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
10+
- sudo apt-get update -qq
11+
- export GCC_VERSION=4.9
12+
- export BOOST_VERSION=57
13+
14+
install:
15+
- sudo apt-get install -qq g++-${GCC_VERSION}
16+
- export CXX="g++-${GCC_VERSION}"
17+
- wget -O boost_1_${BOOST_VERSION}_0.tar.bz2 http://sourceforge.net/projects/boost/files/boost/1.${BOOST_VERSION}.0/boost_1_${BOOST_VERSION}_0.tar.bz2/download
18+
- tar xjf boost_1_${BOOST_VERSION}_0.tar.bz2
19+
- cd boost_1_${BOOST_VERSION}_0
20+
- ./bootstrap.sh
21+
- ./b2 --with-thread --with-atomic --with-date_time --with-system --with-timer --stagedir=stage64 --toolset=gcc-${GCC_VERSION} address-model=64
22+
- cd ..
23+
24+
before_script: cd ./build
25+
26+
script: ./build.sh -b 64 -j 2 -x ${CXX} -z '-Wall -Wextra -pedantic -Wno-unused-local-typedefs' --with-boost ../boost_1_${BOOST_VERSION}_0 -t test_hdr
27+
28+
#after_success:
29+
30+
#after_failure:
31+
32+
after_script: cd ..
33+
34+
# blacklist
35+
#branches:
36+
# except:
37+
# - integration
38+
39+
# whitelist
40+
branches:
41+
only:
42+
- master
43+
- dev
44+
- integration

0 commit comments

Comments
 (0)