Skip to content

Commit

Permalink
Merge pull request #110 from BerkeleyLab/non-type-bound-infer
Browse files Browse the repository at this point in the history
feat(infer): allow non-type-bound invocations
  • Loading branch information
rouson authored Jan 12, 2024
2 parents 2d379ec + af96bce commit b061c7d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion example/concurrent-inferences.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
program concurrent_inferences
!! This program demonstrates how to read a neural network from a JSON file
!! and use the network to perform concurrent inferences.
use inference_engine_m, only : inference_engine_t, tensor_t
use inference_engine_m, only : inference_engine_t, tensor_t, infer
use sourcery_m, only : string_t, command_line_t, file_t
use assert_m, only : assert
use iso_fortran_env, only : int64, real64
Expand Down Expand Up @@ -68,6 +68,15 @@ program concurrent_inferences
end do
call system_clock(t_finish)
print *,"Concurrent inference time: ", real(t_finish - t_start, real64)/real(clock_rate, real64)

print *,"Performing concurrent inference with a non-type-bound inference procedure"
call system_clock(t_start)
do concurrent(i=1:lat, j=1:lon, k=1:lev)
outputs(i,j,k) = infer(inference_engine, inputs(i,j,k))
end do
call system_clock(t_finish)
print *,"Concurrent inference time with non-type-bound procedure: ", real(t_finish - t_start, real64)/real(clock_rate, real64)

end block
end block

Expand Down
1 change: 1 addition & 0 deletions src/inference_engine/inference_engine_m_.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module inference_engine_m_
public :: inference_engine_t
public :: difference_t
public :: exchange_t
public :: infer

character(len=*), parameter :: key(*) = [character(len=len("usingSkipConnections")) :: &
"modelName", "modelAuthor", "compilationDate", "activationFunction", "usingSkipConnections"]
Expand Down
2 changes: 1 addition & 1 deletion src/inference_engine_m.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module inference_engine_m
use differentiable_activation_strategy_m, only : differentiable_activation_strategy_t
use hyperparameters_m, only : hyperparameters_t
use input_output_pair_m, only : input_output_pair_t, shuffle
use inference_engine_m_, only : inference_engine_t, difference_t
use inference_engine_m_, only : inference_engine_t, difference_t, infer
use kind_parameters_m, only : rkind
use mini_batch_m, only : mini_batch_t
use NetCDF_file_m, only : NetCDF_file_t
Expand Down

0 comments on commit b061c7d

Please sign in to comment.