-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from acbbullock/gpu-dev
Large performance and quality improvements
- Loading branch information
Showing
10 changed files
with
1,786 additions
and
1,714 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,21 @@ | ||
program main | ||
!------------------------------------------------------------------------------------------------------------------- | ||
!! This program demonstrates the use of the nnqs module. | ||
!------------------------------------------------------------------------------------------------------------------- | ||
use, intrinsic :: iso_fortran_env, only: rk=>real64 | ||
use nnqs, only: RestrictedBoltzmannMachine !! Neural network type | ||
implicit none (type,external) !! No implicit types or interfaces | ||
!------------------------------------------------------------------------------------------------------------------- | ||
!! This program demonstrates the use of the nnqs module. | ||
!------------------------------------------------------------------------------------------------------------------- | ||
use, intrinsic :: iso_fortran_env, only: rk=>real32 | ||
use nnqs, only: RestrictedBoltzmannMachine !! Neural network type | ||
use omp_lib !! OpenMP module | ||
implicit none (type,external) !! No implicit types or interfaces | ||
|
||
!! Variable Declarations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
type(RestrictedBoltzmannMachine) :: psi !! Neural network | ||
integer :: spins, hidden_units !! Number of spins and hidden units | ||
!! Variable Declarations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
type(RestrictedBoltzmannMachine) :: psi !! Neural network | ||
|
||
!! Begin Executable Code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
call random_init(repeatable=.false., image_distinct=.true.) !! Initialize random number generator | ||
integer, parameter :: spins = 1024, hidden_units = 64 !! Number of spins and hidden units | ||
|
||
spins = 1000 !! Set number of visible units | ||
hidden_units = 50 !! Set number of hidden units | ||
|
||
psi = RestrictedBoltzmannMachine(v_units=spins, h_units=hidden_units) !! Create instance | ||
|
||
call psi%stochastic_optimization(ising_strengths=[ -0.5_rk, 0.1_rk ]) !! Input [J,B] | ||
!! Begin Executable Code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
call random_init(repeatable=.false., image_distinct=.true.) !! Initialize random number generator | ||
call omp_set_default_device(1) !! Set OpenMP offload device (device id depends on system) | ||
|
||
psi = RestrictedBoltzmannMachine(v_units=spins, h_units=hidden_units) !! Create instance | ||
call psi%stochastic_optimization(ising_params=[ -0.5_rk, 0.1_rk ]) !! Input [J,B] and train network | ||
end program main |
Oops, something went wrong.