Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
wbieniec authored Oct 12, 2022
1 parent 466e4f0 commit 02b66c3
Show file tree
Hide file tree
Showing 33 changed files with 16,196 additions and 0 deletions.
2,026 changes: 2,026 additions & 0 deletions CopMEM2.src/CopMEM2.cpp

Large diffs are not rendered by default.

114 changes: 114 additions & 0 deletions CopMEM2.src/CopMEM2.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{93BAC9CD-64AD-4C8C-9D0F-92A6E06FAE8D}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>CopMEM2</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<TargetName>$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<TargetName>$(ProjectName)</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<WholeProgramOptimization>false</WholeProgramOptimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalOptions>-D_SCL_SECURE_NO_WARNINGS %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalOptions>/O2 /arch:AVX2 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\common\StopWatch.h" />
<ClInclude Include="..\common\Hashes.h" />
<ClInclude Include="..\common\kxsort.h" />
<ClInclude Include="..\common\StringUtils.h" />
<ClInclude Include="..\fmt\core.h" />
<ClInclude Include="..\fmt\format-inl.h" />
<ClInclude Include="..\fmt\format.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\common\StopWatch.cpp" />
<ClCompile Include="..\common\city.cpp" />
<ClCompile Include="..\common\StringUtils.cpp" />
<ClCompile Include="..\fmt\format.cc" />
<ClCompile Include="CopMEM2.cpp" />
<ClCompile Include="..\common\metrohash64.cpp" />
<ClCompile Include="..\common\xxhash.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
55 changes: 55 additions & 0 deletions CopMEM2.src/CopMEM2.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="CopMEM2.cpp" />
<ClCompile Include="..\common\city.cpp">
<Filter>common</Filter>
</ClCompile>
<ClCompile Include="..\common\xxhash.c">
<Filter>common</Filter>
</ClCompile>
<ClCompile Include="..\common\StringUtils.cpp">
<Filter>common</Filter>
</ClCompile>
<ClCompile Include="..\common\StopWatch.cpp">
<Filter>common</Filter>
</ClCompile>
<ClCompile Include="..\common\metrohash64.cpp">
<Filter>common</Filter>
</ClCompile>
<ClCompile Include="..\fmt\format.cc">
<Filter>fmt</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\common\StringUtils.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="..\common\StopWatch.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="..\common\kxsort.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="..\common\Hashes.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="..\fmt\core.h">
<Filter>fmt</Filter>
</ClInclude>
<ClInclude Include="..\fmt\format.h">
<Filter>fmt</Filter>
</ClInclude>
<ClInclude Include="..\fmt\format-inl.h">
<Filter>fmt</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="common">
<UniqueIdentifier>{22107579-e21f-4566-9095-3e2f841db9cd}</UniqueIdentifier>
</Filter>
<Filter Include="fmt">
<UniqueIdentifier>{f7013536-9423-41a4-9874-5d04fb6889c0}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
11 changes: 11 additions & 0 deletions CopMEM2.src/CopMEM2.vcxproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>-l 200 -t 8 -o hp100.txt c:\mem\datasets\hum.all.fa c:\mem\datasets\panTro3.fa</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>-l 100 -t 1 -o hm100.txt c:\mem\datasets\hum.all.fa c:\mem\datasets\mus.all.fa</LocalDebuggerCommandArguments>
</PropertyGroup>
</Project>
90 changes: 90 additions & 0 deletions MemoryFill.src/MemoryFill.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/* ================================================================= *
* MemoryFill.cpp : Main file *
* *
* MemoryFill is an auxiliary program that enables "cold start", *
* especially for several runs with the same input files. *
* *
* *
* Copyright (c) 2018, Szymon Grabowski and Wojciech Bieniecki *
* All rights reserved *
* *
* 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, either version 3 of *
* the License, or (at your option) any later version. *
* *
* 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. *
* *
* This file is subject to the terms and conditions defined in the *
* file 'license', which is part of this source code package. *
* ================================================================= */


#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <thread>
#include <chrono>
#include <iostream>
#include <fstream>

void displayHelp(char* name) {
std::cout << "Memory fill, by Szymon Grabowski and Wojciech Bieniecki, May 2018.\n Use: " << name << " <bytes to fill\n";
std::cout << name << " 1024\n";
std::cout << name << " 53k\n";
std::cout << name << " 53M\n";
std::cout << name << " 53G\n";
}

int main(int ac, char* av[])
{
std::cout.setf(std::ios_base::unitbuf);
std::cout << "Memory fill to disable disk caches (--> 'cold start')\n";
if (ac == 1) {
displayHelp(av[0]);
return 0;
}

size_t l = strlen(av[1]);
size_t mult = 1;
switch (av[1][l - 1]) {
case 'k':
mult = 1 << 10;
break;
case 'M':
mult = 1 << 20;
break;
case 'G':
mult = 1 << 30;
break;
}
size_t N = mult * std::atoll(av[1]);
if (N == 0) {
displayHelp(av[0]);
return 0;
}
std::cout << N << " bytes\n";
const size_t num = 100;
const size_t fillSize = N / num;
char** arr = new char*[num];
for (size_t i = 0; i < num; i++) {
std::cout << ".";
arr[i] = new char[fillSize];
if (arr[i] == 0) {
std::cerr << "out of memory";
return -1;
}
memset(arr[i], 170, fillSize);
}
for (size_t i = 0; i < num; i++)
delete [] arr[i];
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
std::cout << " Done!\n";
return 0;
}
Loading

0 comments on commit 02b66c3

Please sign in to comment.