Skip to content

Commit dcd76de

Browse files
committed
Initial project files with Visual Studio solution
1 parent 9e44258 commit dcd76de

File tree

6 files changed

+554
-30
lines changed

6 files changed

+554
-30
lines changed

.gitignore

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,8 @@
1-
# Prerequisites
2-
*.d
31

4-
# Compiled Object files
5-
*.slo
6-
*.lo
7-
*.o
8-
*.obj
2+
# Visual Studio
3+
/.vs
4+
*.vcxproj.user
95

10-
# Precompiled Headers
11-
*.gch
12-
*.pch
13-
14-
# Compiled Dynamic libraries
15-
*.so
16-
*.dylib
17-
*.dll
18-
19-
# Fortran module files
20-
*.mod
21-
*.smod
22-
23-
# Compiled Static libraries
24-
*.lai
25-
*.la
26-
*.a
27-
*.lib
28-
29-
# Executables
30-
*.exe
31-
*.out
32-
*.app
6+
# Output and Intermediate Files
7+
/_out
8+
/_temp

benchmark/benchmark.cpp

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
2+
#include <vector>
3+
#include <fstream>
4+
#include <iostream>
5+
6+
#include "parallel_for.h"
7+
8+
//using namespace profane;
9+
//
10+
//struct PLogTraits
11+
//{
12+
// using Clock = std::chrono::high_resolution_clock;
13+
//
14+
//#pragma pack(push)
15+
//#pragma pack(1)
16+
// struct EventData
17+
// {
18+
// int threadId;
19+
// };
20+
//#pragma pack(pop)
21+
//
22+
// static void OnWorkItem(const EventData& eventData, WorkItemProto<Clock>& workItemProto)
23+
// {
24+
// workItemProto.workerName = std::to_string(eventData.threadId);
25+
// workItemProto.routineName = "W";
26+
// }
27+
//};
28+
//
29+
//using PLog = PerfLogger<PLogTraits>;
30+
//PLog plog{};
31+
32+
struct Matrix
33+
{
34+
int height;
35+
int width;
36+
std::vector<double> data;
37+
38+
double at(int y, int x) const { return data[width * y + x]; }
39+
double& at(int y, int x) { return data[width * y + x]; }
40+
};
41+
42+
Matrix GenerateMatrix(int height, int width)
43+
{
44+
Matrix mat { height, width };
45+
mat.data.resize(height * width);
46+
int idx = 0;
47+
for (auto& value : mat.data)
48+
value = static_cast<double>(idx++ % 5) - 2.0;
49+
return mat;
50+
}
51+
52+
Matrix MatMul(ThreadHive& hive, const Matrix& A, const Matrix& B)
53+
{
54+
assert(A.width == B.height);
55+
Matrix X;
56+
X.height = A.height;
57+
X.width = B.width;
58+
X.data.resize(X.height * X.width, 0.0);
59+
60+
hive.For(0, X.height, 1, 16, [&](int y0, int y1) {
61+
//auto ttx = plog.Trace((int)std::hash<std::thread::id>{}(std::this_thread::get_id()));
62+
while (y0 < y1) {
63+
int y = y0++;
64+
//hive.For(0, X.width, [&, y](int x0, int x1) {
65+
for (int x = 0; x < X.width; ++x)
66+
{
67+
//while (x0 < x1) {
68+
//int x = x0++;
69+
for (int k = 0; k < A.width; ++k)
70+
{
71+
X.at(y, x) += A.at(y, k) * B.at(k, x);
72+
}
73+
//}
74+
}//);
75+
}
76+
});
77+
78+
return X;
79+
}
80+
81+
int main()
82+
{
83+
//plog.Enable("perflog.bin", 100000000);
84+
85+
auto A = GenerateMatrix(340, 450);
86+
auto B = GenerateMatrix(450, 760);
87+
88+
ThreadHive hive;
89+
90+
auto X = MatMul(hive, A, B);
91+
}

benchmark/benchmark.vcxproj

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|x64">
5+
<Configuration>Debug</Configuration>
6+
<Platform>x64</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|x64">
9+
<Configuration>Release</Configuration>
10+
<Platform>x64</Platform>
11+
</ProjectConfiguration>
12+
</ItemGroup>
13+
<PropertyGroup Label="Globals">
14+
<VCProjectVersion>15.0</VCProjectVersion>
15+
<ProjectGuid>{1CFB589E-90DC-4F5C-9605-29A8B6D85726}</ProjectGuid>
16+
<Keyword>Win32Proj</Keyword>
17+
<RootNamespace>benchmark</RootNamespace>
18+
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
19+
</PropertyGroup>
20+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
21+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
22+
<ConfigurationType>Application</ConfigurationType>
23+
<UseDebugLibraries>true</UseDebugLibraries>
24+
<PlatformToolset>v141</PlatformToolset>
25+
<CharacterSet>Unicode</CharacterSet>
26+
</PropertyGroup>
27+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
28+
<ConfigurationType>Application</ConfigurationType>
29+
<UseDebugLibraries>false</UseDebugLibraries>
30+
<PlatformToolset>v141</PlatformToolset>
31+
<WholeProgramOptimization>true</WholeProgramOptimization>
32+
<CharacterSet>Unicode</CharacterSet>
33+
</PropertyGroup>
34+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
35+
<ImportGroup Label="ExtensionSettings">
36+
</ImportGroup>
37+
<ImportGroup Label="Shared">
38+
</ImportGroup>
39+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
40+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
41+
</ImportGroup>
42+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
43+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
44+
</ImportGroup>
45+
<PropertyGroup Label="UserMacros" />
46+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
47+
<LinkIncremental>true</LinkIncremental>
48+
<OutDir>$(SolutionDir)_out\$(ProjectName)-$(Platform)-$(Configuration)\</OutDir>
49+
<IntDir>$(SolutionDir)_temp\$(ProjectName)-$(Platform)-$(Configuration)\</IntDir>
50+
</PropertyGroup>
51+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
52+
<LinkIncremental>false</LinkIncremental>
53+
<OutDir>$(SolutionDir)_out\$(ProjectName)-$(Platform)-$(Configuration)\</OutDir>
54+
<IntDir>$(SolutionDir)_temp\$(ProjectName)-$(Platform)-$(Configuration)\</IntDir>
55+
</PropertyGroup>
56+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
57+
<ClCompile>
58+
<WarningLevel>Level3</WarningLevel>
59+
<Optimization>Disabled</Optimization>
60+
<SDLCheck>true</SDLCheck>
61+
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
62+
<ConformanceMode>true</ConformanceMode>
63+
<PrecompiledHeaderFile>
64+
</PrecompiledHeaderFile>
65+
<AdditionalIncludeDirectories>$(SolutionDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
66+
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
67+
<RuntimeTypeInfo>false</RuntimeTypeInfo>
68+
<OpenMPSupport>false</OpenMPSupport>
69+
<LanguageStandard>stdcpp14</LanguageStandard>
70+
<EnableModules>false</EnableModules>
71+
</ClCompile>
72+
<Link>
73+
<SubSystem>Console</SubSystem>
74+
<GenerateDebugInformation>true</GenerateDebugInformation>
75+
</Link>
76+
</ItemDefinitionGroup>
77+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
78+
<ClCompile>
79+
<WarningLevel>Level3</WarningLevel>
80+
<Optimization>MaxSpeed</Optimization>
81+
<FunctionLevelLinking>true</FunctionLevelLinking>
82+
<IntrinsicFunctions>true</IntrinsicFunctions>
83+
<SDLCheck>true</SDLCheck>
84+
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
85+
<ConformanceMode>true</ConformanceMode>
86+
<PrecompiledHeaderFile>
87+
</PrecompiledHeaderFile>
88+
<AdditionalIncludeDirectories>$(SolutionDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
89+
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
90+
<RuntimeTypeInfo>false</RuntimeTypeInfo>
91+
<OpenMPSupport>false</OpenMPSupport>
92+
<LanguageStandard>stdcpp14</LanguageStandard>
93+
<EnableModules>false</EnableModules>
94+
</ClCompile>
95+
<Link>
96+
<SubSystem>Console</SubSystem>
97+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
98+
<OptimizeReferences>true</OptimizeReferences>
99+
<GenerateDebugInformation>true</GenerateDebugInformation>
100+
</Link>
101+
</ItemDefinitionGroup>
102+
<ItemGroup>
103+
<ClCompile Include="benchmark.cpp" />
104+
</ItemGroup>
105+
<ItemGroup>
106+
<ClInclude Include="..\include\parallel_for.h" />
107+
</ItemGroup>
108+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
109+
<ImportGroup Label="ExtensionTargets">
110+
</ImportGroup>
111+
</Project>

benchmark/benchmark.vcxproj.filters

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="parallel_for">
5+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
6+
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
7+
</Filter>
8+
<Filter Include="src">
9+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
10+
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
11+
</Filter>
12+
</ItemGroup>
13+
<ItemGroup>
14+
<ClCompile Include="benchmark.cpp">
15+
<Filter>src</Filter>
16+
</ClCompile>
17+
</ItemGroup>
18+
<ItemGroup>
19+
<ClInclude Include="..\include\parallel_for.h">
20+
<Filter>parallel_for</Filter>
21+
</ClInclude>
22+
</ItemGroup>
23+
</Project>

0 commit comments

Comments
 (0)