Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
elpa
elpa
Commits
43d89656
Commit
43d89656
authored
Aug 20, 2018
by
Pavel Kus
Browse files
parameters can be saved
parent
a87ab950
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/elpa_api.F90
View file @
43d89656
...
...
@@ -153,7 +153,8 @@ module elpa_api
elpa_solve_tridiagonal_d
,
&
!< matrix
elpa_solve_tridiagonal_f
procedure
(
print_all_parameters_i
),
deferred
,
public
::
print_all_parameters
!< method to set the best options
procedure
(
print_all_parameters_i
),
deferred
,
public
::
print_all_parameters
!< method to print all parameters
procedure
(
save_all_parameters_i
),
deferred
,
public
::
save_all_parameters
!< method to save all parameters
#ifdef ENABLE_AUTOTUNING
! Auto-tune
procedure
(
elpa_autotune_setup_i
),
deferred
,
public
::
autotune_setup
!< method to prepare the ELPA autotuning
...
...
@@ -262,6 +263,21 @@ module elpa_api
end
subroutine
end
interface
!> \brief abstract definition of the save_all_parameters method
!> Parameters
!> \details
!> \param self class(elpa_t): the ELPA object, which should be tuned
!> \param file_name string, the name of the file where to save the parameters
!> Saves all the elpa parameters
abstract
interface
subroutine
save_all_parameters_i
(
self
,
file_name
)
import
elpa_t
implicit
none
class
(
elpa_t
),
intent
(
inout
)
::
self
character
(
*
),
intent
(
in
)
::
file_name
end
subroutine
end
interface
#ifdef ENABLE_AUTOTUNING
!> \brief abstract definition of the autotune setup method
!> Parameters
...
...
src/elpa_impl.F90
View file @
43d89656
...
...
@@ -156,6 +156,7 @@ module elpa_impl
#endif
procedure
,
public
::
print_all_parameters
=>
elpa_print_all_parameters
procedure
,
public
::
save_all_parameters
=>
elpa_save_all_parameters
#ifdef ENABLE_AUTOTUNING
procedure
,
public
::
autotune_setup
=>
elpa_autotune_setup
procedure
,
public
::
autotune_step
=>
elpa_autotune_step
...
...
@@ -1097,12 +1098,28 @@ module elpa_impl
class
(
elpa_impl_t
),
intent
(
inout
)
::
self
!print *, "The following parameters have been set"
if
(
elpa_index_print_all_parameters_c
(
self
%
index
)
/
=
1
)
then
if
(
elpa_index_print_all_parameters_c
(
self
%
index
,
c_null_char
)
/
=
1
)
then
stop
"This should not happen (in elpa_print_all_parameters())"
endif
end
subroutine
!> \brief function to save all the parameters, that have been set
!> Parameters
!> \param self class(elpa_impl_t) the allocated ELPA object
!> \param file_name string, the name of the file where to save the parameters
subroutine
elpa_save_all_parameters
(
self
,
file_name
)
implicit
none
class
(
elpa_impl_t
),
intent
(
inout
)
::
self
character
(
*
),
intent
(
in
)
::
file_name
!print *, "The following parameters have been set"
if
(
elpa_index_print_all_parameters_c
(
self
%
index
,
file_name
//
c_null_char
)
/
=
1
)
then
stop
"This should not happen (in elpa_save_all_parameters())"
endif
end
subroutine
!> \brief function to print the state of the autotuning
!> Parameters
!> \param self class(elpa_impl_t) the allocated ELPA object
...
...
src/elpa_index.c
View file @
43d89656
...
...
@@ -1033,11 +1033,6 @@ int elpa_index_print_autotune_state(elpa_index_t index, int autotune_level, int
int
min_loc_cpy
=
min_loc
;
FILE
*
f
;
if
(
file_name
==
""
)
f
=
stdout
;
else
f
=
fopen
(
file_name
,
"w"
);
// get index with the currently best parameters
index_best
=
elpa_index_instance
();
...
...
@@ -1054,7 +1049,19 @@ int elpa_index_print_autotune_state(elpa_index_t index, int autotune_level, int
}
int
is_process_id_zero
=
elpa_index_get_int_value
(
index
,
"is_process_id_zero"
,
NULL
);
if
(
is_process_id_zero
)
{
if
(
file_name
==
""
)
int
output_to_file
=
(
strlen
(
file_name
)
>
0
);
if
(
output_to_file
)
{
f
=
fopen
(
file_name
,
"w"
);
if
(
f
==
NULL
){
fprintf
(
stderr
,
"Cannot open file %s in elpa_index_print_autotune_state
\n
"
,
file_name
);
return
0
;
}
}
else
{
f
=
stdout
;
}
if
(
!
output_to_file
)
fprintf
(
f
,
"
\n
"
);
fprintf
(
f
,
"*** AUTOTUNING STATE ***
\n
"
);
fprintf
(
f
,
"** This is the state of the autotuning object
\n
"
);
...
...
@@ -1083,18 +1090,21 @@ int elpa_index_print_autotune_state(elpa_index_t index, int autotune_level, int
fprintf
(
f
,
"** No output after first step
\n
"
);
}
fprintf
(
f
,
"*** END OF AUTOTUNING STATE ***
\n
"
);
if
(
output_to_file
)
fclose
(
f
);
}
elpa_index_free
(
index_best
);
if
(
file_name
!=
""
)
fclose
(
f
);
return
1
;
}
int
elpa_index_print_all_parameters
(
elpa_index_t
index
)
{
int
elpa_index_print_all_parameters
(
elpa_index_t
index
,
char
*
file_name
)
{
const
int
LEN
=
10000
;
char
out_structure
[
LEN
],
out_set
[
LEN
],
out_defaults
[
LEN
],
out_nowhere
[
LEN
],
buff
[
100
];
char
(
*
out
)[
LEN
];
FILE
*
f
;
sprintf
(
out_structure
,
"Parameters describing structure of the computation:
\n
"
);
sprintf
(
out_set
,
"Parameters explicitly set by the user:
\n
"
);
sprintf
(
out_defaults
,
"Parameters with default or environment value:
\n
"
);
...
...
@@ -1113,9 +1123,24 @@ int elpa_index_print_all_parameters(elpa_index_t index) {
elpa_index_print_int_parameter
(
index
,
buff
,
i
);
sprintf
(
*
out
,
"%s%s"
,
*
out
,
buff
);
}
fprintf
(
stdout
,
"*** ELPA STATE ***
\n
"
);
fprintf
(
stdout
,
"%s
\n
%s
\n
%s"
,
out_structure
,
out_set
,
out_defaults
);
fprintf
(
stdout
,
"*** END OF ELPA STATE ***
\n
"
);
int
output_to_file
=
(
strlen
(
file_name
)
>
0
);
if
(
output_to_file
)
{
f
=
fopen
(
file_name
,
"w"
);
if
(
f
==
NULL
){
fprintf
(
stderr
,
"Cannot open file %s in elpa_index_print_all_parameters
\n
"
,
file_name
);
return
0
;
}
}
else
{
f
=
stdout
;
}
fprintf
(
f
,
"*** ELPA STATE ***
\n
"
);
fprintf
(
f
,
"%s
\n
%s
\n
%s"
,
out_structure
,
out_set
,
out_defaults
);
fprintf
(
f
,
"*** END OF ELPA STATE ***
\n
"
);
if
(
output_to_file
)
fclose
(
f
);
}
return
1
;
}
src/elpa_index.h
View file @
43d89656
...
...
@@ -437,16 +437,17 @@ int elpa_index_print_autotune_parameters(elpa_index_t index, int autotune_level,
/*
!f> interface
!f> function elpa_index_print_all_parameters_c(index) result(success) &
!f> function elpa_index_print_all_parameters_c(index
, file_name
) result(success) &
!f> bind(C, name="elpa_index_print_all_parameters")
!f> import c_int, c_ptr, c_char
!f> type(c_ptr), intent(in), value :: index
!f> character(kind=c_char), intent(in) :: file_name(*)
!f> integer(kind=c_int) :: success
!f> end function
!f> end interface
!f>
*/
int
elpa_index_print_all_parameters
(
elpa_index_t
index
);
int
elpa_index_print_all_parameters
(
elpa_index_t
index
,
char
*
filename
);
/*
!f> interface
...
...
test/Fortran/test_autotune.F90
View file @
43d89656
...
...
@@ -220,6 +220,7 @@ program test
iter
=
iter
+1
write
(
iter_string
,
'(I5.5)'
)
iter
call
e
%
print_all_parameters
()
call
e
%
save_all_parameters
(
"saved_parameters_"
//
trim
(
iter_string
)//
".txt"
)
call
e
%
timer_start
(
"eigenvectors: iteration "
//
trim
(
iter_string
))
call
e
%
eigenvectors
(
a
,
ev
,
z
,
error
)
call
e
%
timer_stop
(
"eigenvectors: iteration "
//
trim
(
iter_string
))
...
...
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