Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mandelbrot-explorer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ильин Владимир Александрович
mandelbrot-explorer
Commits
a5de1545
Commit
a5de1545
authored
Feb 17, 2025
by
Ильин Владимир Александрович
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
semi working ver with okayish performance
parent
c297970b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
6 deletions
+12
-6
Makefile
Makefile
+5
-2
gmon.out
gmon.out
+0
-0
mandelbrot
mandelbrot
+0
-0
mandelbrot.c
src/mandelbrot.c
+7
-4
No files found.
Makefile
View file @
a5de1545
CFLAGS
=
-Wno-unused-command-line-argument
-Wno-missing-field-initializers
-Wall
-Wextra
-Wpedantic
-lm
-fopenmp
CFLAGS
=
-Wno-unused-command-line-argument
-Wno-missing-field-initializers
-Wall
-Wextra
-Wpedantic
-lm
OPENMPFLAGS
=
-fopenmp
CLFLAGS
=
-D
CL_TARGET_OPENCL_VERSION
=
100
-lOpenCL
DEBUG_CFLAGS
=
-g
-DDEBUG
-pg
-O0
LDLIBS
=
$(
shell
pkg-config
--libs
sdl2 SDL2_ttf
)
#CFLAGS := $(CFLAGS) -O3
CFLAGS
:=
$(CFLAGS)
$(DEBUG_CFLAGS)
CFLAGS
:=
$(CFLAGS)
$(DEBUG_CFLAGS)
$(CLFLAGS)
$(OPENMPFLAGS)
SRCDIR
=
src
BIULDDIR
=
build
...
...
gmon.out
View file @
a5de1545
No preview for this file type
mandelbrot
View file @
a5de1545
No preview for this file type
src/mandelbrot.c
View file @
a5de1545
...
...
@@ -7,6 +7,8 @@
#include <stdio.h>
#include <SDL2/SDL.h>
#include <complex.h>
#include <CL/cl.h>
//#include <omp.h>
#include "mandelbrot.h"
#include "mouse.h"
...
...
@@ -45,6 +47,7 @@ void
calculate_set
(
Array
*
arr
,
int
height
,
int
width
,
ViewInfo
view
)
{
//printf("arr size: %d, screen %d\n", arr->size, height * width);
#pragma omp parallel for schedule(guided)
for
(
int
x
=
0
;
x
<
width
;
x
++
)
{
for
(
int
y
=
0
;
y
<
height
;
y
++
)
{
double
real
=
view
.
x_min
+
(
x
*
(
view
.
x_max
-
view
.
x_min
))
/
width
;
...
...
@@ -69,12 +72,12 @@ calculate_set(Array *arr, int height, int width, ViewInfo view)
}
void
render_cl
(
Array
*
arr
,
App
*
app
,
ViewInfo
view
,
int
start_x
,
int
start_y
)
{
render_cl
(
Array
*
arr
,
App
*
app
,
ViewInfo
view
)
{
SDL_SetRenderDrawColor
(
app
->
renderer
,
0
,
0
,
50
,
255
);
SDL_RenderClear
(
app
->
renderer
);
if
(
arr
->
size
<
app
->
win_height
*
app
->
win_width
*
sizeof
(
Color
)){
if
(
arr
->
size
<
app
->
win_height
*
app
->
win_width
*
(
int
)
sizeof
(
Color
)){
arr
->
pointer
=
realloc
(
arr
->
pointer
,
app
->
win_height
*
app
->
win_width
*
sizeof
(
Color
));
arr
->
size
=
app
->
win_height
*
app
->
win_width
*
sizeof
(
Color
);
}
...
...
@@ -129,7 +132,7 @@ render(App *app, ViewInfo view, int start_x, int end_x, int start_y, int end_y)
int
main
(
int
argc
,
char
*
argv
[]
)
main
(
void
)
{
if
(
SDL_Init
(
SDL_INIT_EVERYTHING
)
!=
0
){
printf
(
"error initializing SDL: %s
\n
"
,
SDL_GetError
());
...
...
@@ -229,7 +232,7 @@ main(int argc, char *argv[])
//drawing happens here
SDL_SetRenderDrawColor
(
app
.
renderer
,
0xff
,
0xff
,
0xff
,
0xff
);
SDL_RenderClear
(
app
.
renderer
);
render_cl
(
&
screen
,
&
app
,
view
,
0
,
0
);
render_cl
(
&
screen
,
&
app
,
view
);
// render(&app,
// view,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment