Skip to content

Commit

Permalink
Merge pull request #58 from milancurcic/refactor-for-convnets
Browse files Browse the repository at this point in the history
Refactor for convnets
  • Loading branch information
milancurcic authored May 4, 2022
2 parents 1d6fa05 + 440439d commit 4b211b4
Show file tree
Hide file tree
Showing 58 changed files with 2,160 additions and 1,749 deletions.
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

78 changes: 36 additions & 42 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,6 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "release")
endif()

# handle integer size
if(INT)
message(STATUS "Configuring build for ${INT}-bit integers")
add_definitions(-DINT${INT})
else()
message(STATUS "Configuring build for 32-bit integers")
add_definitions(-DINT32)
endif()

# handle real size
if(REAL)
message(STATUS "Configuring build for ${REAL}-bit reals")
add_definitions(-DREAL${REAL})
else()
message(STATUS "Configuring build for 32-bit reals")
add_definitions(-DREAL32)
endif()

if(SERIAL)
message(STATUS "Configuring build for serial execution")
else()
Expand All @@ -51,9 +33,8 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES GNU)
message(STATUS "Configuring build to use BLAS from ${BLAS}")
endif()

set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -cpp")
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -C -fbacktrace")
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -ffast-math")
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -fcheck=bounds -fbacktrace")
set(CMAKE_Fortran_FLAGS_RELEASE "-Ofast -fno-frontend-optimize")
endif()

# compiler flags for ifort
Expand All @@ -64,7 +45,7 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES Intel)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -coarray=single")
endif()

set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp -assume byterecl,realloc_lhs -heap-arrays")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -assume byterecl")
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -C -traceback")
set(CMAKE_Fortran_FLAGS_RELEASE "-O3")

Expand All @@ -83,36 +64,49 @@ endif()

# library to archive (libneural.a)
add_library(neural
src/mod_activation.f90
src/mod_activation_submodule.f90
src/mod_io.f90
src/mod_io_submodule.f90
src/mod_kinds.f90
src/mod_layer.f90
src/mod_layer_submodule.f90
src/mod_mnist.f90
src/mod_mnist_submodule.f90
src/mod_network.f90
src/mod_network_submodule.f90
src/mod_parallel.f90
src/mod_parallel_submodule.f90
src/mod_random.f90
src/mod_random_submodule.f90
src/nf_activation.f90
src/nf_base_layer.f90
src/nf_base_layer_submodule.f90
src/nf_conv2d_layer.f90
src/nf_datasets_mnist.f90
src/nf_datasets_mnist_submodule.f90
src/nf_dense_layer.f90
src/nf_dense_layer_submodule.f90
src/nf.f90
src/nf_input1d_layer.f90
src/nf_input1d_layer_submodule.f90
src/nf_input3d_layer.f90
src/nf_input3d_layer_submodule.f90
src/nf_io.f90
src/nf_io_submodule.f90
src/nf_layer_constructors.f90
src/nf_layer_constructors_submodule.f90
src/nf_layer.f90
src/nf_layer_submodule.f90
src/nf_loss.f90
src/nf_loss_submodule.f90
src/nf_network.f90
src/nf_network_submodule.f90
src/nf_optimizers.f90
src/nf_parallel.f90
src/nf_parallel_submodule.f90
src/nf_random.f90
src/nf_random_submodule.f90
)

# Remove leading or trailing whitespace
string(REGEX REPLACE "^ | $" "" LIBS "${LIBS}")

# tests
enable_testing()
foreach(execid mnist network_save network_sync set_activation_function)
foreach(execid input1d_layer dense_layer dense_network)
add_executable(test_${execid} test/test_${execid}.f90)
target_link_libraries(test_${execid} neural ${LIBS})
add_test(test_${execid} bin/test_${execid})
endforeach()

foreach(execid mnist mnist_epochs save_and_load simple sine)
add_executable(example_${execid} example/example_${execid}.f90)
target_link_libraries(example_${execid} neural ${LIBS})
add_test(example_${execid} bin/example_${execid})
foreach(execid mnist simple sine)
add_executable(${execid} example/${execid}.f90)
target_link_libraries(${execid} neural ${LIBS})
#add_test(example_${execid} bin/example_${execid})
endforeach()
Loading

0 comments on commit 4b211b4

Please sign in to comment.