Merge branch 'master' into arm
Conflicts: Makefile builtins.cpp ispc.cpp ispc.h ispc.vcxproj opt.cpp
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
|
||||
EXAMPLE=mandelbrot
|
||||
CPP_SRC=mandelbrot.cpp mandelbrot_serial.cpp
|
||||
ISPC_SRC=mandelbrot.ispc
|
||||
EXAMPLE=mandelbrot_tasks
|
||||
CPP_SRC=mandelbrot_tasks.cpp mandelbrot_tasks_serial.cpp
|
||||
ISPC_SRC=mandelbrot_tasks.ispc
|
||||
ISPC_IA_TARGETS=sse2,sse4-x2,avx-x2
|
||||
ISPC_ARM_TARGETS=neon
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#include <algorithm>
|
||||
#include <string.h>
|
||||
#include "../timing.h"
|
||||
#include "mandelbrot_ispc.h"
|
||||
#include "mandelbrot_tasks_ispc.h"
|
||||
using namespace ispc;
|
||||
|
||||
extern void mandelbrot_serial(float x0, float y0, float x1, float y1,
|
||||
@@ -21,7 +21,7 @@
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{E80DA7D4-AB22-4648-A068-327307156BE6}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>mandelbrot</RootNamespace>
|
||||
<RootNamespace>mandelbrot_tasks</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
@@ -65,22 +65,22 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<ExecutablePath>$(ProjectDir)..\..;$(ExecutablePath)</ExecutablePath>
|
||||
<TargetName>mandelbrot</TargetName>
|
||||
<TargetName>mandelbrot_tasks</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<ExecutablePath>$(ProjectDir)..\..;$(ExecutablePath)</ExecutablePath>
|
||||
<TargetName>mandelbrot</TargetName>
|
||||
<TargetName>mandelbrot_tasks</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<ExecutablePath>$(ProjectDir)..\..;$(ExecutablePath)</ExecutablePath>
|
||||
<TargetName>mandelbrot</TargetName>
|
||||
<TargetName>mandelbrot_tasks</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<ExecutablePath>$(ProjectDir)..\..;$(ExecutablePath)</ExecutablePath>
|
||||
<TargetName>mandelbrot</TargetName>
|
||||
<TargetName>mandelbrot_tasks</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
@@ -153,12 +153,12 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="mandelbrot.cpp" />
|
||||
<ClCompile Include="mandelbrot_serial.cpp" />
|
||||
<ClCompile Include="mandelbrot_tasks.cpp" />
|
||||
<ClCompile Include="mandelbrot_tasks_serial.cpp" />
|
||||
<ClCompile Include="../tasksys.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="mandelbrot.ispc">
|
||||
<CustomBuild Include="mandelbrot_tasks.ispc">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ispc -O2 %(Filename).ispc -o $(TargetDir)%(Filename).obj -h $(TargetDir)%(Filename)_ispc.h --arch=x86 --target=sse2,sse4-x2,avx-x2
|
||||
</Command>
|
||||
|
||||
@@ -22,7 +22,7 @@ mandelbrot
|
||||
#***
|
||||
Mandelbrot Set
|
||||
mandelbrot_tasks
|
||||
mandelbrot
|
||||
mandelbrot_tasks
|
||||
^
|
||||
#***
|
||||
Perlin Noise Function
|
||||
|
||||
@@ -73,10 +73,19 @@ def cpu_get():
|
||||
#returns cpu_usage
|
||||
def cpu_check():
|
||||
if is_windows == False:
|
||||
cpu1 = cpu_get()
|
||||
time.sleep(1)
|
||||
cpu2 = cpu_get()
|
||||
cpu_percent = (float(cpu1[0] - cpu2[0])/float(cpu1[1] - cpu2[1]))*100
|
||||
if is_mac == False:
|
||||
cpu1 = cpu_get()
|
||||
time.sleep(1)
|
||||
cpu2 = cpu_get()
|
||||
cpu_percent = (float(cpu1[0] - cpu2[0])/float(cpu1[1] - cpu2[1]))*100
|
||||
else:
|
||||
os.system("sysctl -n vm.loadavg > cpu_temp")
|
||||
c = open("cpu_temp", 'r')
|
||||
c_line = c.readline()
|
||||
c.close
|
||||
os.remove("cpu_temp")
|
||||
R = c_line.split(' ')
|
||||
cpu_percent = float(R[1]) * 3
|
||||
else:
|
||||
os.system("wmic cpu get loadpercentage /value > cpu_temp")
|
||||
c = open("cpu_temp", 'r')
|
||||
@@ -143,6 +152,8 @@ parser.add_option('-p', '--path', dest='path',
|
||||
global is_windows
|
||||
is_windows = (platform.system() == 'Windows' or
|
||||
'CYGWIN_NT' in platform.system())
|
||||
global is_mac
|
||||
is_mac = (platform.system() == 'Darwin')
|
||||
|
||||
# save corrent path
|
||||
pwd = os.getcwd()
|
||||
|
||||
@@ -365,7 +365,7 @@ lAtomicCompareAndSwap32(volatile int32_t *v, int32_t newValue, int32_t oldValue)
|
||||
static inline int32_t
|
||||
lAtomicAdd(volatile int32_t *v, int32_t delta) {
|
||||
#ifdef ISPC_IS_WINDOWS
|
||||
return InterlockedAdd((volatile LONG *)v, delta);
|
||||
return InterlockedExchangeAdd((volatile LONG *)v, delta)+delta;
|
||||
#else
|
||||
return __sync_fetch_and_add(v, delta);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user