Commit 81706f8e authored by Roy Fabrice's avatar Roy Fabrice
Browse files

openmp should be checked and tested

parent d1f84617
......@@ -75,14 +75,17 @@ contains
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)
!$omp parallel default(none) shared(halos_array,position_com,mpi_process) &
!$omp private(thread_id, ihalo,current_file,input_file_id,input_file_name,group_id,group_name)&
!$omp firstprivate(output_data_id)
thread_id = omp_get_thread_num()
!$omp master
write(OUTPUT_UNIT,*) 'MASTER: THREAD SHOULD BE 0 :',thread_id
current_file = halos_array%parameters%halo_file_ids(halos_array%first_halo_index)
input_file_name = trim(halos_array%parameters%halos_data_directory)//trim(halos_array%parameters%halos_file_names(current_file))
input_file_name = trim(halos_array%parameters%halos_data_directory)//&
trim(halos_array%parameters%halos_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)
......@@ -91,7 +94,8 @@ contains
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%halos_data_directory)//trim(halos_array%parameters%halos_file_names(current_file))
input_file_name = trim(halos_array%parameters%halos_data_directory)//&
trim(halos_array%parameters%halos_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)
......@@ -101,18 +105,23 @@ contains
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)
write(OUTPUT_UNIT,*) 'THREAD SHOULD BE 0 :',thread_id
write(*,*) 'COM DANS TASK: ',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)
!$omp end task
write(*,*) 'COM HORS TASK: ',thread_id, mpi_process%rank, ihalo, position_com(:,ihalo)
! 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
do ihalo = halos_array%first_halo_index, halos_array%last_halo_index
call halos_array%halos(ihalo)%Write_hdf5(output_data_id, halos_array%properties)
end do
! call halos_array%halos(halos_array%first_halo_index)%Write_hdf5(output_data_id, halos_array%properties)
call hdf5_close_file(output_file_id)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment