Skip to content

Commit

Permalink
Merge pull request #13 from nedtaylor/development
Browse files Browse the repository at this point in the history
1.3.0
  • Loading branch information
nedtaylor committed Mar 13, 2024
2 parents 4841b10 + 46606fb commit 0d3f02b
Show file tree
Hide file tree
Showing 110 changed files with 4,715 additions and 2,573 deletions.
113 changes: 113 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: run-cmake-build

on:
push:
paths:
- ".github/workflows/cmake.yml"
- "CMakeLists.txt"
- "**.f90"
pull_request:
paths:
- ".github/workflows/cmake.yml"
- "CMakeLists.txt"
- "**.f90"
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build-and-test-cmake-debug:
environment:
name: github-pages
name: Build and test in debug mode
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
compiler: [gcc]
version: [13]
steps:
- name: checkout repo
uses: actions/checkout@v4

- name: actions-setup-cmake
uses: jwlawson/actions-setup-cmake@v2.0.1
with:
cmake-version: '3.24.x'

- uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}

- name: Install gcovr
run: |
pip --version
pip install gcovr
- name: Compile
run: |
cmake --version
gfortran --version
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
make install
- name: Test
run: |
gfortran --version
ctest
build-and-test-cmake-release:
environment:
name: github-pages
name: Build and test in release mode
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
compiler: [gcc]
version: [13]
steps:
- name: checkout repo
uses: actions/checkout@v4

- name: actions-setup-cmake
uses: jwlawson/actions-setup-cmake@v2.0.1
with:
cmake-version: '3.24.x'

- uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}

- name: Compile
run: |
cmake --version
gfortran --version
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
make install
- name: Test
run: |
gfortran --version
ctest

4 changes: 1 addition & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
compiler: [gcc]
version: [13]
steps:
- name: checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: actions-setup-cmake
uses: jwlawson/actions-setup-cmake@v2.0.1
Expand All @@ -63,7 +62,6 @@ jobs:
cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
./test/test_regulariser
make coverage
- name: Get coverage percentage
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/fpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
version: [13]
steps:
- name: checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- uses: fortran-lang/setup-fortran@v1
id: setup-fortran
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:

steps:
- name: checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- uses: fortran-lang/setup-fortran@v1
id: setup-fortran
Expand Down
25 changes: 25 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed

## [1.3.0] - 2024-03-13

### Added
- batchnorm1d_layer_type (handles both 1D spatial channel data and rank 0 channel data)
- base_layer submodule file
- network submodule file
- Added comments to network and base_layer procedure interfaces

### Changed
- Improved comment and headers in all source files
- Improved comments in all test source files
- Added interfaces within base_layer submodules for ease of readability
- Added interfaces within network submodules for ease of readability
- Moved methods of base_layer into submodule
- Moved methods of network into submodule

### Fixed
- Remove reference to doc/ directory
- Fixed typo in example library
- Fixed example/mnist/src/main.f90 using wrong constants module
- Fixed cmake isntall path prefix duplication issue

### Removed
- Deprecate and remove step_decay and lr_reduce_on_plateau procedures

## [1.2.4] - 2024-03-07

### Added
Expand Down
16 changes: 11 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ if (CMAKE_BUILD_TYPE MATCHES "Debug*" OR CMAKE_BUILD_TYPE MATCHES "Dev*")
EXECUTABLE ctest
EXCLUDE "${PROJECT_SOURCE_DIR}/test/*")
endif()
# add coverage compiler flags
append_coverage_compiler_flags()
endif()

# enable testing
Expand Down Expand Up @@ -95,6 +93,8 @@ set(LIB_FILES
mod_loss.f90
mod_accuracy.f90
mod_base_layer.f90
mod_base_layer_sub.f90
mod_batchnorm1d_layer.f90
mod_batchnorm2d_layer.f90
mod_batchnorm3d_layer.f90
mod_conv2d_layer.f90
Expand All @@ -117,6 +117,7 @@ set(LIB_FILES
mod_container_layer.f90
mod_container_layer_sub.f90
mod_network.f90
mod_network_sub.f90
)
foreach(lib ${LIB_FILES})
list(APPEND PREPENDED_LIB_FILES ${LIB_DIR}/${lib})
Expand Down Expand Up @@ -202,8 +203,8 @@ target_link_libraries(${PROJECT_NAME} PUBLIC)
string(REGEX REPLACE "\\.[^.]*$" ".mod" MODULE_FILES "${SRC_FILES}")

# installation
install(FILES ${MODULE_DIR}/${MODULE_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(FILES ${MODULE_DIR}/${MODULE_FILES} DESTINATION include)
install(TARGETS ${PROJECT_NAME} DESTINATION lib)

# set compile options based on different build configurations
target_compile_options(${PROJECT_NAME} PUBLIC "$<$<CONFIG:Release>:${OPTIMFLAGS}>")
Expand All @@ -216,5 +217,10 @@ target_compile_options(${PROJECT_NAME} PUBLIC "$<$<CONFIG:Parallel_Dev>:${DEVFLA

# include the build test directory
if(BUILD_TESTS)
add_subdirectory(test)
add_subdirectory(test)
endif()

# add coverage compiler flags
if (CMAKE_BUILD_TYPE MATCHES "Debug*" OR CMAKE_BUILD_TYPE MATCHES "Dev*")
append_coverage_compiler_flags()
endif()
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ ATHENA is distributed with the following directories:

| Directory | Description |
|---|---|
| example/ | A set of example programs utilising the ATHENA library |
| _example/_ | A set of example programs utilising the ATHENA library |
| _src/_ | Source code |
| _tools/_ | Additional shell script tools for automating learning |
| test/ | A set of test programs to check functionality of the library works after compilation |
| _test/_ | A set of test programs to check functionality of the library works after compilation |


Documentation
Expand Down Expand Up @@ -204,6 +204,7 @@ Files
|_src/lib/mod_activation.f90_ | generic node activation (transfer) setup |
|_src/lib/mod_activation__[_NAME_]_.f90_ | [_NAME_] activation method |
|_src/lib/mod_base_layer.f90_ | abstract layer construct type |
|_src/lib/mod_base_layer_sub.f90_ | base layer submodule |
|_src/lib/mod_clipper.f90_ | gradient clipping procedures |
|_src/lib/mod_constants.f90_ | a set of global constants used in this code |
|_src/lib/mod_container.f90_ | layer container construct for handling multiple layers in a network |
Expand All @@ -217,6 +218,7 @@ Files
|_src/lib/mod_misc.f90_ | miscellaneous procedures |
|_src/lib/mod_misc_ml.f90_ | miscellaneous machine learning procedures |
|_srcs/lib/mod_network.f90_ | neural network derived type and procedures |
|_srcs/lib/mod_network_sub.f90_ | network submodule |
|_src/lib/mod_normalisation.f90_ | data normalisation procedures |
|_src/lib/mod_optimiser.f90_ | learning optimisation derived type and procedures |
|_src/lib/mod_random.f90_ | random number procedures |
Expand Down
4 changes: 2 additions & 2 deletions example/example_library/src/mod_constants.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module constants_minst
module constants_mnist
implicit none
integer, parameter, public :: real12 = Selected_real_kind(6,37)!(15,307)
real(real12), parameter, public :: k_b = 1.3806503e-23_real12
Expand All @@ -18,4 +18,4 @@ module constants_minst
real(real12), parameter, public :: INF = huge(0._real12)
complex(real12), parameter, public :: imag=(0._real12, 1._real12)
integer, public :: ierror = -1
end module constants_minst
end module constants_mnist
6 changes: 3 additions & 3 deletions example/example_library/src/mod_misc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
!!! to_upper (converts all characters in string to upper case)
!!! to_lower (converts all characters in string to lower case)
!!!#############################################################################
module misc_minst
use constants_minst, only: real12
module misc_mnist
use constants_mnist, only: real12
implicit none


Expand Down Expand Up @@ -1766,4 +1766,4 @@ pure function to_lower(buffer) result(lower)
end function to_lower
!!!#####################################################

end module misc_minst
end module misc_mnist
4 changes: 2 additions & 2 deletions example/example_library/src/mod_read_mnist.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module read_mnist
use constants_minst, only: real12
use constants_mnist, only: real12
use athena, only: pad_data
implicit none

Expand All @@ -13,7 +13,7 @@ module read_mnist
!!! read mnist dataset
!!!#############################################################################
subroutine read_mnist_db(file,images,labels,kernel_size,image_size,padding_method)
use misc_minst, only: icount
use misc_mnist, only: icount
implicit none
integer :: i, j, k, Reason, unit
integer :: num_samples, num_pixels, t_kernel_size = 1
Expand Down
2 changes: 1 addition & 1 deletion example/mnist/src/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ program mnist_example
use omp_lib
#endif
use athena
use constants, only: real12
use constants_mnist, only: real12
use read_mnist, only: read_mnist_db
use inputs

Expand Down
2 changes: 1 addition & 1 deletion example/mnist_3D/src/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ program mnist_test
use omp_lib
#endif
use athena
use constants_minst, only: real12
use constants_mnist, only: real12
use read_mnist, only: read_mnist_db
use inputs

Expand Down
2 changes: 1 addition & 1 deletion example/mnist_bn/src/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ program mnist_example
use omp_lib
#endif
use athena
use constants_minst, only: real12
use constants_mnist, only: real12
use read_mnist, only: read_mnist_db
use inputs

Expand Down
2 changes: 1 addition & 1 deletion example/mnist_drop/src/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ program mnist_test
use omp_lib
#endif
use athena
use constants_minst, only: real12
use constants_mnist, only: real12
use read_mnist, only: read_mnist_db
use inputs

Expand Down
2 changes: 1 addition & 1 deletion example/simple/src/main.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
program simple
use athena
use constants_minst, only: real12, pi
use constants_mnist, only: real12, pi

implicit none

Expand Down
2 changes: 1 addition & 1 deletion example/sine/src/main.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
program sine
use athena
use constants_minst, only: real12, pi
use constants_mnist, only: real12, pi

implicit none

Expand Down
2 changes: 1 addition & 1 deletion fpm.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "athena"
version = "1.2.4"
version = "1.3.0"
license = "MIT"
author = "Ned Thaddeus Taylor"
maintainer = "n.t.taylor@exeter.ac.uk"
Expand Down
8 changes: 6 additions & 2 deletions src/athena.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
!!!#############################################################################
!!! Code written by Ned Thaddeus Taylor
!!! Code part of the ARTEMIS group (Hepplestone research group)
!!! Think Hepplestone, think HRG
!!! Code part of the ATHENA library - a feedforward neural network library
!!!#############################################################################
!!! module contains all publicly available types and procedures within the ...
!!! ... ATHENA library
!!! No other types or procedures should be needed to be accessed by the user
!!!#############################################################################
module athena
use misc_ml, only: shuffle, split, pad_data
Expand Down Expand Up @@ -50,6 +53,7 @@ module athena
use input4d_layer, only: input4d_layer_type

!! batch normalisation layer types
use batchnorm1d_layer, only: batchnorm1d_layer_type, read_batchnorm1d_layer
use batchnorm2d_layer, only: batchnorm2d_layer_type, read_batchnorm2d_layer
use batchnorm3d_layer, only: batchnorm3d_layer_type, read_batchnorm3d_layer

Expand Down
Loading

0 comments on commit 0d3f02b

Please sign in to comment.