Skip to content

Commit

Permalink
Merge pull request #231 from BerkeleyLab/openmp-inference-example
Browse files Browse the repository at this point in the history
Fix OpenMP directives in example/concurrrent-inferences.f90
  • Loading branch information
rouson authored Nov 25, 2024
2 parents 513970a + 0726978 commit 6787b6a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions example/concurrent-inferences.f90
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ program concurrent_inferences
neural_network = neural_network_t(double_precision_file_t(network_file_name))

print *,"Defining an array of tensor_t input objects with random normalized components"
allocate(outputs(lat,lon,lev))
allocate( inputs(lat,lon,lev))
allocate(input_components(lat,lon,lev,neural_network%num_inputs()))
allocate(outputs(lat,lev,lon))
allocate( inputs(lat,lev,lon))
allocate(input_components(lat,lev,lon,neural_network%num_inputs()))
call random_number(input_components)

do concurrent(i=1:lat, j=1:lon, k=1:lev)
inputs(i,j,k) = tensor_t(input_components(i,j,k,:))
do concurrent(i=1:lat, k=1:lev, j=1:lon)
inputs(i,k,j) = tensor_t(input_components(i,k,j,:))
end do

print *,"Performing double-precision concurrent inference"
call system_clock(t_start, clock_rate)
do concurrent(i=1:lat, j=1:lon, k=1:lev)
outputs(i,j,k) = neural_network%infer(inputs(i,j,k))
do concurrent(i=1:lat, k=1:lev, j=1:lon)
outputs(i,k,j) = neural_network%infer(inputs(i,k,j))
end do
call system_clock(t_finish)
print *,"Double-precision concurrent inference time: ", real(t_finish - t_start, real64)/real(clock_rate, real64)
Expand Down
6 changes: 3 additions & 3 deletions scripts/create-single-source-file-programs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ if [ ! -d "$assert_dir" ] || [ ! -d $julienne_dir ]; then
fi

if [ -d ../build/dependencies/assert ] && [ -d ../build/dependencies/julienne ]; then
echo "------------- Dependencies assert and julienne are in ../build/dependencies ------------------"
echo "Dependencies Assert and Julienne are in ../build/dependencies"
else
echo "Dependencies assert and julienne are not in ../build/dependencies. Something went wrong."
echo "Dependencies Assert and Julienne are not in ../build/dependencies. Something went wrong."
exit 1
fi

Expand All @@ -56,5 +56,5 @@ cp "$assert_dir/include/assert_macros.h" "$destination_dir"
cat "$julienne_dir/include/language-support.F90" "$fiats_dir/include/language-support.F90" > "$destination_dir"/language-support.F90
cp "$fiats_dir/include/compound_assertions.h" "$destination_dir"

echo "Concatenating Assert, Julienne, Fiats, and example/concurrent-inferences.f90 into $destination_dir"
echo "Concatenating Assert, Julienne, Fiats, and example/concurrent-inferences.f90 into $destination_dir/concurrent-inferences-single-file.F90"
cat "$destination_dir"/assert.F90 "$destination_dir"/julienne.F90 "$destination_dir"/fiats.F90 "$fiats_dir/example/concurrent-inferences.f90" > $destination_dir/concurrent-inferences-single-file.F90

0 comments on commit 6787b6a

Please sign in to comment.