diff --git a/DirectProgramming/DPC++/CombinationalLogic/mandelbrot/License.txt b/DirectProgramming/DPC++/CombinationalLogic/mandelbrot/License.txt index 9cde07f558..8f608e972a 100644 --- a/DirectProgramming/DPC++/CombinationalLogic/mandelbrot/License.txt +++ b/DirectProgramming/DPC++/CombinationalLogic/mandelbrot/License.txt @@ -1,4 +1,4 @@ -Copyright Intel Corporation +Copyright 2019 Intel Corporation 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: diff --git a/DirectProgramming/DPC++/CombinationalLogic/mandelbrot/mandelbrot.vcxproj b/DirectProgramming/DPC++/CombinationalLogic/mandelbrot/mandelbrot.vcxproj index 19bac293d5..8a4eaa9d40 100644 --- a/DirectProgramming/DPC++/CombinationalLogic/mandelbrot/mandelbrot.vcxproj +++ b/DirectProgramming/DPC++/CombinationalLogic/mandelbrot/mandelbrot.vcxproj @@ -114,7 +114,6 @@ Console true - $(ONEAPI_ROOT)\compiler\latest\windows\bin\libsycl-complex.o @@ -152,10 +151,9 @@ true true true - $(ONEAPI_ROOT)\compiler\latest\windows\bin\libsycl-complex.o - \ No newline at end of file + diff --git a/DirectProgramming/DPC++/CombinationalLogic/mandelbrot/src/CMakeLists.txt b/DirectProgramming/DPC++/CombinationalLogic/mandelbrot/src/CMakeLists.txt index 9cd8f8f64d..4c3d57303d 100644 --- a/DirectProgramming/DPC++/CombinationalLogic/mandelbrot/src/CMakeLists.txt +++ b/DirectProgramming/DPC++/CombinationalLogic/mandelbrot/src/CMakeLists.txt @@ -2,10 +2,10 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=c++17") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") add_executable(mandelbrot main.cpp) -target_link_libraries(mandelbrot OpenCL sycl $ENV{ONEAPI_ROOT}/compiler/latest/linux/lib/libsycl-complex.o) -add_custom_target(run ${CMAKE_COMMAND} -E env SYCL_BE=PI_OPENCL ./mandelbrot) +target_link_libraries(mandelbrot OpenCL sycl) +add_custom_target(run ./mandelbrot) add_executable(mandelbrot_usm main.cpp) target_compile_definitions(mandelbrot_usm PRIVATE MANDELBROT_USM) -target_link_libraries(mandelbrot_usm OpenCL sycl $ENV{ONEAPI_ROOT}/compiler/latest/linux/lib/libsycl-complex.o) -add_custom_target(run_usm ${CMAKE_COMMAND} -E env SYCL_BE=PI_OPENCL ./mandelbrot_usm) +target_link_libraries(mandelbrot_usm OpenCL sycl) +add_custom_target(run_usm ./mandelbrot_usm) diff --git a/DirectProgramming/DPC++/CombinationalLogic/mandelbrot/src/mandel.hpp b/DirectProgramming/DPC++/CombinationalLogic/mandelbrot/src/mandel.hpp index 991478032c..7c261a5e56 100644 --- a/DirectProgramming/DPC++/CombinationalLogic/mandelbrot/src/mandel.hpp +++ b/DirectProgramming/DPC++/CombinationalLogic/mandelbrot/src/mandel.hpp @@ -33,6 +33,10 @@ struct MandelParameters { int max_iterations_; typedef std::complex ComplexF; + static std::complex complex_square( std::complex c) + { + return std::complex( c.real()*c.real() - c.imag()*c.imag(), c.real()*c.imag()*2 ); + } MandelParameters(int row_count, int col_count, int max_iterations) : row_count_(row_count), @@ -41,7 +45,7 @@ struct MandelParameters { int row_count() const { return row_count_; } int col_count() const { return col_count_; } - int max_iterations() const { return max_iterations_; } +int max_iterations() const { return max_iterations_; } // Scale from 0..row_count to -1.5..0.5 float ScaleRow(int i) const { return -1.5f + (i * (2.0f / row_count_)); } @@ -63,7 +67,8 @@ struct MandelParameters { break; } - z = z * z + c; + // z = z * z + c; + z = complex_square(z) + c; count++; }