Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Roy Fabrice
pFoF
Commits
61f0d35c
Commit
61f0d35c
authored
Apr 06, 2020
by
Roy Fabrice
Browse files
changes related to halos_array mv to common
parent
9e5ca040
Changes
4
Hide whitespace changes
Inline
Side-by-side
halo_post/src/Makefile
View file @
61f0d35c
...
...
@@ -14,12 +14,13 @@ SRC = char_utils_m.f90 \
mpi_utils_m.f90
\
timer_m.f90
\
common_shared_variables_m.f90
\
halo_post_parameters_m.f90
\
halo_properties_m.f90
\
halo_utils_m.f90
\
halo_m.f90
\
halo_post_functions_m.f90
\
halos_array_m.f90
\
halo_post_parameters_m.f90
\
process_halos_array_m.f90
\
halo_post.f90
OBJS_NOPREFIX
=
$(SRC:%.f90=%.o)
...
...
halo_post/src/halo_post.f90
View file @
61f0d35c
...
...
@@ -32,11 +32,14 @@ program halo_post
use
common_shared_variables_m
use
fortran_hdf5_manage_interface_m
use
halos_array_m
use
halo_post_parameters_m
use
mpi
use
process_halos_array_m
implicit
none
type
(
halos_array_t
)
::
halos_array
type
(
halo_post_parameters_t
)
::
parameters
integer
::
mpierr
integer
::
thread_provided
...
...
@@ -44,7 +47,12 @@ program halo_post
call
mpi_process
%
Init
()
call
hdf5_init
()
call
halos_array
%
Process
()
! read halo_post parameters
call
parameters
%
Read
()
! initialize halos_array
call
halos_array
%
Init
(
parameters
)
! process halos_array
call
Process_halos_array
(
halos_array
)
call
hdf5_finalize
()
...
...
halo_post/src/halo_post_parameters_m.f90
View file @
61f0d35c
...
...
@@ -33,6 +33,7 @@ module halo_post_parameters_m
use
constants_m
,
only
:
IDKIND
use
error_handling_m
use
fortran_hdf5_constants_m
,
only
:
H5_FILENAME_LEN
use
halos_array_m
,
only
:
halos_array_parameters_t
use
iso_fortran_env
use
mpi
...
...
@@ -42,14 +43,7 @@ module halo_post_parameters_m
public
::
halo_post_parameters_t
type
halo_post_parameters_t
integer
::
files_number
integer
::
halos_number
character
(
len
=
H5_FILENAME_LEN
)
::
data_directory
character
(
len
=
H5_FILENAME_LEN
)
::
file_name_halo_ids
character
(
len
=
H5_FILENAME_LEN
),
allocatable
,
dimension
(:)
::
file_names
integer
(
kind
=
IDKIND
),
allocatable
,
dimension
(:)
::
halo_ids
integer
,
allocatable
,
dimension
(:)
::
halo_file_ids
type
,
extends
(
halos_array_parameters_t
)
::
halo_post_parameters_t
contains
procedure
,
private
::
Check
=>
Check_halo_post_parameters
procedure
::
Write
=>
Write_halo_post_parameters
...
...
halo_post/src/process_halos_array_m.f90
0 → 100644
View file @
61f0d35c
module
process_halos_array_m
use
common_shared_variables_m
use
iso_fortran_env
,
only
:
ERROR_UNIT
,
OUTPUT_UNIT
implicit
none
contains
!------------------------------------------------------------------------------------------------------------------------------------
subroutine
Process_halos_array
(
halos_array
)
use
fortran_hdf5_constants_m
use
fortran_hdf5_manage_files_m
use
fortran_hdf5_manage_groups_m
use
halo_post_functions_m
use
halos_array_m
use
hdf5
use
omp_lib
type
(
halos_array_t
),
intent
(
inout
)
::
halos_array
integer
::
current_file
integer
(
HID_T
)
::
input_file_id
character
(
H5_FILENAME_LEN
)
::
input_file_name
character
(
H5_STR_LEN
)
::
group_name
integer
(
HID_T
)
::
group_id
integer
::
ihalo
integer
::
thread_id
type
(
halos_array_t
)
::
halos_array_init
integer
(
HID_T
)
::
output_data_id
integer
(
HID_T
)
::
output_file_id
character
(
H5_FILENAME_LEN
)
::
output_file_name
real
,
allocatable
,
dimension
(:,:)
::
position_com
#ifdef DEBUG
write
(
ERROR_UNIT
,
'(a,i0)'
)
'Process_array begins on process'
,
mpi_process
%
rank
#endif
allocate
(
position_com
(
3
,
halos_array
%
first_halo_index
:
halos_array
%
last_halo_index
))
! open output file
output_file_name
=
'halo_post_output_00000.h5'
write
(
output_file_name
(
len
(
trim
(
output_file_name
))
-7
:
len
(
trim
(
output_file_name
))
-3
),
'(i5.5)'
)
&
mpi_process
%
rank
call
hdf5_create_file
(
output_file_name
,
output_file_id
)
group_name
=
'data'
call
hdf5_create_group
(
output_file_id
,
group_name
,
output_data_id
)
!$omp parallel default(none) shared(halos_array,position_com,mpi_process, output_data_id) &
!$omp private(thread_id, ihalo,current_file,input_file_id,input_file_name,group_id,group_name)
thread_id
=
omp_get_thread_num
()
!$omp master
current_file
=
halos_array
%
parameters
%
halo_file_ids
(
halos_array
%
first_halo_index
)
input_file_name
=
trim
(
halos_array
%
parameters
%
data_directory
)//
trim
(
halos_array
%
parameters
%
file_names
(
current_file
))
call
hdf5_open_file
(
input_file_name
,
input_file_id
)
group_name
=
'data'
call
hdf5_open_group
(
input_file_id
,
group_name
,
group_id
)
do
ihalo
=
halos_array
%
first_halo_index
,
halos_array
%
last_halo_index
if
(
halos_array
%
parameters
%
halo_file_ids
(
ihalo
)
/
=
current_file
)
then
call
hdf5_close_group
(
group_id
)
call
hdf5_close_file
(
input_file_id
)
current_file
=
halos_array
%
parameters
%
halo_file_ids
(
ihalo
)
input_file_name
=
trim
(
halos_array
%
parameters
%
data_directory
)//
trim
(
halos_array
%
parameters
%
file_names
(
current_file
))
call
hdf5_open_file
(
input_file_name
,
input_file_id
)
group_name
=
'data'
call
hdf5_open_group
(
input_file_id
,
group_name
,
group_id
)
end
if
call
halos_array
%
halos
(
ihalo
)
%
Read_hdf5
(
group_id
,
halos_array
%
properties
)
!$omp task untied
call
compute_center_of_mass
(
halos_array
%
halos
(
ihalo
),
position_com
(:,
ihalo
))
! lock_halo(ihalo) = 1
!$omp task untied if(thread_id == 0)
write
(
*
,
*
)
'COM: '
,
thread_id
,
mpi_process
%
rank
,
ihalo
,
position_com
(:,
ihalo
)
! call halos_array%halos(ihalo)%Write_hdf5(output_data_id, halos_array%properties)
!$omp end task
!$omp end task
write
(
*
,
*
)
'MASTER: '
,
ihalo
,
halos_array
%
halos
(
ihalo
)
%
particles_number
call
halos_array
%
halos
(
ihalo
)
%
Write_hdf5
(
output_data_id
,
halos_array
%
properties
)
end
do
call
hdf5_close_group
(
group_id
)
call
hdf5_close_file
(
input_file_id
)
!$omp end master
!$omp end parallel
! call halos_array%halos(halos_array%first_halo_index)%Write_hdf5(output_data_id, halos_array%properties)
call
hdf5_close_file
(
output_file_id
)
#ifdef DEBUG
write
(
ERROR_UNIT
,
'(a,i0)'
)
'Process_halos_array ends on process'
,
mpi_process
%
rank
#endif
end
subroutine
Process_halos_array
end
module
process_halos_array_m
\ No newline at end of file
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