Skip to content

Instantly share code, notes, and snippets.

View BillyONeal's full-sized avatar

Billy O'Neal BillyONeal

View GitHub Profile
@BillyONeal
BillyONeal / Results
Last active June 9, 2017 03:34
Hello World Parallel Bench Derived From OpenMP Hello World Example
cl /Zi /std:c++latest /MD /EHsc /O2 /openmp .\openmp.cpp
cl /Zi /std:c++latest /MD /EHsc /O2 .\parallel_for_each_comparative.cpp
cl /D_HAS_AUTO_PTR_ETC=1 /std:c++latest /MD /EHsc /O2 /IC:\Users\bion\Desktop\vcpkg-export-20170608-100432\installed\x86-windows\include .\hpx_for_each.cpp /link /libpath:C:\Users\bion\Desktop\vcpkg-export-20170608-100432\installed\x86-windows\lib hpx.lib hpx_init.lib boost_program_options-vc140-mt-1_64.lib boost_system-vc140-mt-1_64.lib boost_timer-vc140-mt-1_64.lib boost_date_time-vc140-mt-1_64.lib boost_thread-vc140-mt-1_64.lib
PS TEST WCFB01 C:\Users\bion\Desktop>.\parallel_for_each_comparative.exe
Testing sequential
A[70] is 1
Sequential took 2874ms
@BillyONeal
BillyONeal / hpx_for_each.cpp
Created June 9, 2017 03:41
HPX Comparative
#include <hpx/hpx.hpp>
#include <hpx/hpx_init.hpp>
#include <hpx/parallel/algorithms/for_each.hpp>
#include <stdio.h>
#include <chrono>
#include <cstddef>
#include <iterator>
#include <vector>
#include "stopwatch.hpp"
@BillyONeal
BillyONeal / algorithm
Created June 9, 2017 21:24
Overhauled inplace_merge
// TEMPLATE FUNCTION inplace_merge WITH PRED
// The "usual invariants" for the inplace_merge helpers below are:
// [_First, _Mid) and [_Mid, _Last) are sorted
// _Pred(*_Mid, *_First) note: this means *_Mid is the "lowest" element
// _Pred(*prev(_Last), *prev(_Mid)) note: this means *prev(_Mid) is the "highest" element
// _Count1 == distance(_First, _Mid)
// _Count2 == distance(_Mid, _Last)
// _Count1 > 1
// _Count2 > 1
template<class _BidIt> inline
@BillyONeal
BillyONeal / future.cpp
Created June 11, 2017 06:20
Visual C++ vMajorNext <future>
// STACK TRACE FUNCTIONS
_VCP_STATIC_ASSERT(_STD is_same<
decltype(__std_async_capture_stack_trace),
decltype(RtlCaptureStackBackTrace)
>::value);
// THREADPOOL FUNCTIONS
struct _Legacy_threadpool_thunk_data
{
@BillyONeal
BillyONeal / execution
Created June 13, 2017 06:39
Poor Reverse Perf
// PARALLEL FUNCTION TEMPLATE reverse
template<class _BidIt>
struct _Reverse_partition
{
_BidIt _First;
_BidIt _Stop_at;
_BidIt _Last;
};
template<class _BidIt,
@BillyONeal
BillyONeal / hpx_reverse.cpp
Created June 13, 2017 20:20
HPX reverse comparative
#include <hpx/hpx.hpp>
#include <hpx/hpx_init.hpp>
#include <hpx/parallel/algorithms/reverse.hpp>
#include <algorithm>
#include <execution>
#include <functional>
#include <random>
#include <vector>
#include "stopwatch.hpp"
// STRUCT TEMPLATE _Static_partition_set
template<class _FwdIt>
struct _Iterator_range
{ // record of a partition of work
_FwdIt _First;
_FwdIt _Last;
explicit operator bool() const
{
return (_First != _Last);
@BillyONeal
BillyONeal / CommandLineProcess.cs
Created September 1, 2017 01:55
Because System.Diagnostics.Process is the worst class in the BCL
// /********************************************************
// * *
// * Copyright (C) Microsoft. All rights reserved. *
// * *
// ********************************************************/
namespace Runall.CLI
{
using System;
using System.Runtime.InteropServices;
@BillyONeal
BillyONeal / append_char.asm
Created September 28, 2017 22:48
String Things
; Function compile flags: /Ogtpy
; COMDAT _append_char
_TEXT SEGMENT
tv636 = -4 ; size = 4
__New_ptr$1$ = 8 ; size = 4
_x$ = 8 ; size = 4
_append_char PROC ; COMDAT
; File c:\users\bion\desktop\test.cpp
; Line 3
00000 51 push ecx
@BillyONeal
BillyONeal / execution
Last active November 17, 2017 10:54
Parallel remove_if
// PARALLEL FUNCTION TEMPLATES remove AND remove_if
template<class _InIt,
class _OutIt,
class _Pr>
_OutIt _Remove_move_if_unchecked(_InIt _First, const _InIt _Last, _OutIt _Dest, _Pr _Pred)
{ // move omitting each element satisfying _Pred
for (; _First != _Last; ++_First)
{
if (!_Pred(*_First))
{