Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Mpp
MLUQ
Commits
898f53ed
Commit
898f53ed
authored
May 05, 2021
by
niklas.baumgarten
Browse files
added power of two warning
parent
7af3cf30
Changes
2
Hide whitespace changes
Inline
Side-by-side
mlmc/src/Main.cpp
View file @
898f53ed
#include
"m++.hpp"
#include
"Main.hpp"
#ifdef COMPLEX
#error undef COMPLEX in src/Compiler.h
#endif
int
main
(
int
argc
,
char
**
argv
)
{
Config
::
setSearchPath
(
"../mlmc/"
);
Config
::
setConfigFileName
(
"m++.conf"
);
Mpp
::
initialize
(
&
argc
,
argv
);
Config
::
setSearchPath
(
"../mlmc/"
);
Config
::
setConfigFileName
(
"m++.conf"
);
Mpp
::
initialize
(
&
argc
,
argv
);
if
(
!
PowerOfTwo
(
PPM
->
Size
(
0
)))
{
Warning
(
"Number of process is not a power of 2."
"This might lead to undefined behaviour."
)
}
MainProgram
mainProgram
;
return
mainProgram
.
Run
();
MainProgram
mainProgram
;
return
mainProgram
.
Run
();
}
mlmc/src/Main.hpp
View file @
898f53ed
...
...
@@ -4,6 +4,12 @@
#include
"montecarlo/MultilevelMonteCarlo.hpp"
bool
PowerOfTwo
(
int
n
)
{
if
(
n
==
0
)
return
false
;
return
(
ceil
(
log2
(
n
))
==
floor
(
log2
(
n
)));
}
class
MainProgram
{
private:
int
verbose
=
1
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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