Skip to content

Commit d0fe654

Browse files
committed
Adding changes to mandelbrot to remove libsycl-complex.so dependency
1 parent a71bd0f commit d0fe654

File tree

6 files changed

+12
-38
lines changed

6 files changed

+12
-38
lines changed

DirectProgramming/DPC++/CombinationalLogic/mandelbrot/License.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
<<<<<<< HEAD
21
Copyright 2019 Intel Corporation
3-
=======
4-
Copyright Intel Corporation
5-
>>>>>>> 646c0545c8df6680d8d8a84b191ce56b698e346e
62

73
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
84

DirectProgramming/DPC++/CombinationalLogic/mandelbrot/README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,9 @@ This code sample is licensed under MIT license.
2525

2626
## Building the `Mandelbrot` Program for CPU and GPU
2727

28-
<<<<<<< HEAD
29-
=======
3028
### Include Files
3129
The include folder is located at %ONEAPI_ROOT%\dev-utilities\latest\include on your development system.
3230

33-
>>>>>>> 646c0545c8df6680d8d8a84b191ce56b698e346e
3431
### Running Samples In DevCloud
3532
If running a sample in the Intel DevCloud, remember that you must specify the compute node (CPU, GPU, FPGA) as well whether to run in batch or interactive mode. For more information see the Intel® oneAPI Base Toolkit Get Started Guide (https://devcloud.intel.com/oneapi/get-started/base-toolkit/)
3633

@@ -65,15 +62,6 @@ $ make
6562
Right click on the project in Solution explorer and select Rebuild.
6663
From top menu select Debug -> Start without Debugging.
6764
68-
<<<<<<< HEAD
69-
>If you see the following error message when compiling this sample:
70-
>
71-
```
72-
Error 'dpc_common.hpp' file not found
73-
```
74-
>You need to add the following directory to the list of include folders, that are required by your project, in your project's Visual Studio project property panel. The missing include folder is located at `%ONEAPI_ROOT%\dev-utilities\latest\include` on your development system.
75-
=======
76-
>>>>>>> 646c0545c8df6680d8d8a84b191ce56b698e346e
7765
7866
* Build the program using MSBuild
7967
Open "x64 Native Tools Command Prompt for VS2017" or "x64 Native Tools Command Prompt for VS2019"

DirectProgramming/DPC++/CombinationalLogic/mandelbrot/mandelbrot.vcxproj

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
<ClCompile Include="src\main.cpp" />
1515
</ItemGroup>
1616
<ItemGroup>
17-
<<<<<<< HEAD
18-
<ClInclude Include="src\dpc_common.hpp" />
19-
=======
20-
>>>>>>> 646c0545c8df6680d8d8a84b191ce56b698e346e
2117
<ClInclude Include="src\mandel.hpp" />
2218
</ItemGroup>
2319
<ItemGroup>
@@ -113,15 +109,11 @@
113109
<ConformanceMode>true</ConformanceMode>
114110
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
115111
<SYCLWarningLevel>Level3</SYCLWarningLevel>
116-
<<<<<<< HEAD
117-
=======
118112
<AdditionalIncludeDirectories>$(ONEAPI_ROOT)dev-utilities\latest\include</AdditionalIncludeDirectories>
119-
>>>>>>> 646c0545c8df6680d8d8a84b191ce56b698e346e
120113
</ClCompile>
121114
<Link>
122115
<SubSystem>Console</SubSystem>
123116
<GenerateDebugInformation>true</GenerateDebugInformation>
124-
<AdditionalDependencies>$(ONEAPI_ROOT)\compiler\latest\windows\bin\libsycl-complex.o</AdditionalDependencies>
125117
</Link>
126118
</ItemDefinitionGroup>
127119
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -159,10 +151,9 @@
159151
<EnableCOMDATFolding>true</EnableCOMDATFolding>
160152
<OptimizeReferences>true</OptimizeReferences>
161153
<GenerateDebugInformation>true</GenerateDebugInformation>
162-
<AdditionalDependencies>$(ONEAPI_ROOT)\compiler\latest\windows\bin\libsycl-complex.o</AdditionalDependencies>
163154
</Link>
164155
</ItemDefinitionGroup>
165156
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
166157
<ImportGroup Label="ExtensionTargets">
167158
</ImportGroup>
168-
</Project>
159+
</Project>

DirectProgramming/DPC++/CombinationalLogic/mandelbrot/mandelbrot.vcxproj.filters

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@
1515
</Filter>
1616
</ItemGroup>
1717
<ItemGroup>
18-
<<<<<<< HEAD
19-
<ClInclude Include="src\dpc_common.hpp">
20-
<Filter>Header Files</Filter>
21-
</ClInclude>
22-
=======
23-
>>>>>>> 646c0545c8df6680d8d8a84b191ce56b698e346e
2418
<ClInclude Include="src\mandel.hpp">
2519
<Filter>Header Files</Filter>
2620
</ClInclude>

DirectProgramming/DPC++/CombinationalLogic/mandelbrot/src/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=c++17")
22
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
33

44
add_executable(mandelbrot main.cpp)
5-
target_link_libraries(mandelbrot OpenCL sycl $ENV{ONEAPI_ROOT}/compiler/latest/linux/lib/libsycl-complex.o)
6-
add_custom_target(run ${CMAKE_COMMAND} -E env SYCL_BE=PI_OPENCL ./mandelbrot)
5+
target_link_libraries(mandelbrot OpenCL sycl)
6+
add_custom_target(run ./mandelbrot)
77

88
add_executable(mandelbrot_usm main.cpp)
99
target_compile_definitions(mandelbrot_usm PRIVATE MANDELBROT_USM)
10-
target_link_libraries(mandelbrot_usm OpenCL sycl $ENV{ONEAPI_ROOT}/compiler/latest/linux/lib/libsycl-complex.o)
11-
add_custom_target(run_usm ${CMAKE_COMMAND} -E env SYCL_BE=PI_OPENCL ./mandelbrot_usm)
10+
target_link_libraries(mandelbrot_usm OpenCL sycl)
11+
add_custom_target(run_usm ./mandelbrot_usm)

DirectProgramming/DPC++/CombinationalLogic/mandelbrot/src/mandel.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ struct MandelParameters {
3333
int max_iterations_;
3434

3535
typedef std::complex<float> ComplexF;
36+
static std::complex<float> complex_square( std::complex<float> c)
37+
{
38+
return std::complex<float>( c.real()*c.real() - c.imag()*c.imag(), c.real()*c.imag()*2 );
39+
}
3640

3741
MandelParameters(int row_count, int col_count, int max_iterations)
3842
: row_count_(row_count),
@@ -41,7 +45,7 @@ struct MandelParameters {
4145

4246
int row_count() const { return row_count_; }
4347
int col_count() const { return col_count_; }
44-
int max_iterations() const { return max_iterations_; }
48+
int max_iterations() const { return max_iterations_; }
4549

4650
// Scale from 0..row_count to -1.5..0.5
4751
float ScaleRow(int i) const { return -1.5f + (i * (2.0f / row_count_)); }
@@ -63,7 +67,8 @@ struct MandelParameters {
6367
break;
6468
}
6569

66-
z = z * z + c;
70+
// z = z * z + c;
71+
z = complex_square(z) + c;
6772
count++;
6873
}
6974

0 commit comments

Comments
 (0)