Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
76f5bb2f
Commit
76f5bb2f
authored
6 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Embed code initialization
parent
b9e61699
No related branches found
No related tags found
1 merge request
!8
Feature/kokkos encapsulate
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/main.cpp
+2
-65
2 additions, 65 deletions
src/main.cpp
src/utils/PastisUtils.cpp
+81
-1
81 additions, 1 deletion
src/utils/PastisUtils.cpp
src/utils/PastisUtils.hpp
+1
-1
1 addition, 1 deletion
src/utils/PastisUtils.hpp
with
84 additions
and
67 deletions
src/main.cpp
+
2
−
65
View file @
76f5bb2f
#include
<iostream>
#include
<PastisUtils.hpp>
#include
<RevisionInfo.hpp>
#include
<rang.hpp>
#include
<FPEManager.hpp>
#include
<SignalManager.hpp>
#include
<ConsoleManager.hpp>
#include
<Connectivity.hpp>
...
...
@@ -25,72 +22,12 @@
#include
<GmshReader.hpp>
#include
<CLI/CLI.hpp>
#include
<limits>
#include
<map>
int
main
(
int
argc
,
char
*
argv
[])
{
long
unsigned
number
=
10
;
std
::
string
filename
;
{
CLI
::
App
app
{
"Pastis help"
};
app
.
add_option
(
"-n,--number"
,
number
,
"Number of cells"
);
//->required();
app
.
add_option
(
"filename,-f,--filename"
,
filename
,
"gmsh file"
);
//->required();
int
threads
=-
1
;
app
.
add_option
(
"--threads"
,
threads
,
"Number of Kokkos threads"
)
->
check
(
CLI
::
Range
(
1
,
std
::
numeric_limits
<
decltype
(
threads
)
>::
max
()));
std
::
string
colorize
=
"auto"
;
app
.
add_set
(
"--colorize"
,
colorize
,
{
"auto"
,
"yes"
,
"no"
},
"Colorize console output"
,
true
);
bool
disable_fpe
=
false
;
app
.
add_flag
(
"--no-fpe"
,
disable_fpe
,
"Do not trap floating point exceptions"
);
bool
disable_signals
=
false
;
app
.
add_flag
(
"--no-signal"
,
disable_signals
,
"Do not catches signals"
);
std
::
string
pause_on_error
=
"auto"
;
app
.
add_set
(
"--pause-on-error"
,
pause_on_error
,
{
"auto"
,
"yes"
,
"no"
},
"Pause for debugging on unexpected error"
,
true
);
std
::
atexit
([](){
std
::
cout
<<
rang
::
style
::
reset
;});
try
{
app
.
parse
(
argc
,
argv
);
}
catch
(
const
CLI
::
ParseError
&
e
)
{
return
app
.
exit
(
e
);
}
ConsoleManager
::
init
(
colorize
);
FPEManager
::
init
(
not
disable_fpe
);
SignalManager
::
setPauseForDebug
(
pause_on_error
);
SignalManager
::
init
(
not
disable_signals
);
}
std
::
cout
<<
"Code version: "
<<
rang
::
style
::
bold
<<
RevisionInfo
::
version
()
<<
rang
::
style
::
reset
<<
'\n'
;
std
::
cout
<<
"-------------------- "
<<
rang
::
fg
::
green
<<
"git info"
<<
rang
::
fg
::
reset
<<
" -------------------------"
<<
'\n'
;
std
::
cout
<<
"tag: "
<<
rang
::
fg
::
reset
<<
rang
::
style
::
bold
<<
RevisionInfo
::
gitTag
()
<<
rang
::
style
::
reset
<<
'\n'
;
std
::
cout
<<
"HEAD: "
<<
rang
::
style
::
bold
<<
RevisionInfo
::
gitHead
()
<<
rang
::
style
::
reset
<<
'\n'
;
std
::
cout
<<
"hash: "
<<
rang
::
style
::
bold
<<
RevisionInfo
::
gitHash
()
<<
rang
::
style
::
reset
<<
" ("
;
if
(
RevisionInfo
::
gitIsClean
())
{
std
::
cout
<<
rang
::
fgB
::
green
<<
"clean"
<<
rang
::
fg
::
reset
;
}
else
{
std
::
cout
<<
rang
::
fgB
::
red
<<
"dirty"
<<
rang
::
fg
::
reset
;
}
std
::
cout
<<
")
\n
"
;
std
::
cout
<<
"-------------------------------------------------------
\n
"
;
initialize
(
argc
,
argv
);
Kokkos
::
DefaultExecutionSpace
::
print_configuration
(
std
::
cout
);
std
::
string
filename
=
initialize
(
argc
,
argv
);
std
::
map
<
std
::
string
,
double
>
method_cost_map
;
...
...
This diff is collapsed.
Click to expand it.
src/utils/PastisUtils.cpp
+
81
−
1
View file @
76f5bb2f
#include
<PastisUtils.hpp>
#include
<Kokkos_Core.hpp>
void
initialize
(
int
&
argc
,
char
*
argv
[])
#include
<RevisionInfo.hpp>
#include
<rang.hpp>
#include
<FPEManager.hpp>
#include
<SignalManager.hpp>
#include
<ConsoleManager.hpp>
#include
<CLI/CLI.hpp>
std
::
string
initialize
(
int
&
argc
,
char
*
argv
[])
{
long
unsigned
number
=
10
;
std
::
string
filename
;
std
::
cout
<<
"Pastis version: "
<<
rang
::
style
::
bold
<<
RevisionInfo
::
version
()
<<
rang
::
style
::
reset
<<
'\n'
;
std
::
cout
<<
"-------------------- "
<<
rang
::
fg
::
green
<<
"git info"
<<
rang
::
fg
::
reset
<<
" -------------------------"
<<
'\n'
;
std
::
cout
<<
"tag: "
<<
rang
::
fg
::
reset
<<
rang
::
style
::
bold
<<
RevisionInfo
::
gitTag
()
<<
rang
::
style
::
reset
<<
'\n'
;
std
::
cout
<<
"HEAD: "
<<
rang
::
style
::
bold
<<
RevisionInfo
::
gitHead
()
<<
rang
::
style
::
reset
<<
'\n'
;
std
::
cout
<<
"hash: "
<<
rang
::
style
::
bold
<<
RevisionInfo
::
gitHash
()
<<
rang
::
style
::
reset
<<
" ("
;
if
(
RevisionInfo
::
gitIsClean
())
{
std
::
cout
<<
rang
::
fgB
::
green
<<
"clean"
<<
rang
::
fg
::
reset
;
}
else
{
std
::
cout
<<
rang
::
fgB
::
red
<<
"dirty"
<<
rang
::
fg
::
reset
;
}
std
::
cout
<<
")
\n
"
;
std
::
cout
<<
"-------------------------------------------------------
\n
"
;
{
CLI
::
App
app
{
"Pastis help"
};
app
.
add_option
(
"-n,--number"
,
number
,
"Number of cells"
);
//->required();
app
.
add_option
(
"filename,-f,--filename"
,
filename
,
"gmsh file"
);
//->required();
int
threads
=-
1
;
app
.
add_option
(
"--threads"
,
threads
,
"Number of Kokkos threads"
)
->
check
(
CLI
::
Range
(
1
,
std
::
numeric_limits
<
decltype
(
threads
)
>::
max
()));
std
::
string
colorize
=
"auto"
;
app
.
add_set
(
"--colorize"
,
colorize
,
{
"auto"
,
"yes"
,
"no"
},
"Colorize console output"
,
true
);
bool
disable_fpe
=
false
;
app
.
add_flag
(
"--no-fpe"
,
disable_fpe
,
"Do not trap floating point exceptions"
);
bool
disable_signals
=
false
;
app
.
add_flag
(
"--no-signal"
,
disable_signals
,
"Do not catches signals"
);
std
::
string
pause_on_error
=
"auto"
;
app
.
add_set
(
"--pause-on-error"
,
pause_on_error
,
{
"auto"
,
"yes"
,
"no"
},
"Pause for debugging on unexpected error"
,
true
);
std
::
atexit
([](){
std
::
cout
<<
rang
::
style
::
reset
;});
try
{
app
.
parse
(
argc
,
argv
);
}
catch
(
const
CLI
::
ParseError
&
e
)
{
std
::
exit
(
app
.
exit
(
e
));
}
ConsoleManager
::
init
(
colorize
);
FPEManager
::
init
(
not
disable_fpe
);
SignalManager
::
setPauseForDebug
(
pause_on_error
);
SignalManager
::
init
(
not
disable_signals
);
}
Kokkos
::
initialize
(
argc
,
argv
);
std
::
cout
<<
"-------------------- "
<<
rang
::
fg
::
green
<<
"exec info"
<<
rang
::
fg
::
reset
<<
" ------------------------"
<<
'\n'
;
std
::
cout
<<
rang
::
style
::
bold
;
Kokkos
::
DefaultExecutionSpace
::
print_configuration
(
std
::
cout
);
std
::
cout
<<
rang
::
style
::
reset
;
std
::
cout
<<
"-------------------------------------------------------
\n
"
;
return
filename
;
}
void
finalize
()
...
...
This diff is collapsed.
Click to expand it.
src/utils/PastisUtils.hpp
+
1
−
1
View file @
76f5bb2f
...
...
@@ -26,7 +26,7 @@ void parallel_reduce(const size_t& size,
Kokkos
::
parallel_reduce
(
label
,
size
,
array
,
value
);
}
void
initialize
(
int
&
argc
,
char
*
argv
[]);
std
::
string
initialize
(
int
&
argc
,
char
*
argv
[]);
void
finalize
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment