Skip to content

Commit

Permalink
Adapt some script changes from other libs, give proper names to examp…
Browse files Browse the repository at this point in the history
…le folders, add CLion .idea files.
  • Loading branch information
Ithanil committed Apr 16, 2019
1 parent 3b540cd commit 18cc40f
Show file tree
Hide file tree
Showing 42 changed files with 216 additions and 52 deletions.
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,28 @@ xcuserdata
DerivedData
*.xcuserstate

# --- JetBrains Clion files (selective)
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
.idea/**/contentModel.xml
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
.idea/**/gradle.xml
.idea/**/libraries
.idea/**/mongoSettings.xml
.idea_modules/
.idea/replstate.xml
.idea/httpRequests


# -- project specific ignores --
lib*
build
Expand Down
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/FeedForwardNeuralNetwork.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 67 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion benchmark/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
if [ "$1" = "" ]; then
echo "Expected the name of the benchmark to run as first argument."
else
bench=$1
bench=${1%"/"} # remove any trailing /
outfile="$(pwd)/${bench}/benchmark_new.out"
cd ../build/benchmark/
echo
Expand Down
10 changes: 6 additions & 4 deletions benchmark/run_prof.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

if [ "$1" = "" ]; then
echo "Expected the name of the benchmark to run as first argument."
elif [ "$2" = "" ]; then
echo "Expected the path of libprofiler.so as second argument."
else
bench=$1
bench=${1%"/"} # remove any trailing /
lprof=$2
if [ "$lprof" = "" ]; then
echo "Using default libprofiler.so path: /usr/lib/libprofiler.so"
lprof="/usr/lib/libprofiler.so"
fi;
cd ../build/benchmark/
echo
echo "Running benchmark ${bench}..."
LD_PRELOAD=${lprof} CPUPROFILE=${bench}.prof CPUPROFILE_FREQUENCY=10000 CPUPROFILE_REALTIME=1 ./${bench}
pprof --text ${bench} ${bench}.prof
echo
fi
fi;
20 changes: 10 additions & 10 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
link_libraries(ffnn)

add_executable(ex1.exe ex1/main.cpp)
add_executable(ex2.exe ex2/main.cpp)
add_executable(ex3.exe ex3/main.cpp)
add_executable(ex4.exe ex4/main.cpp)
add_executable(ex5.exe ex5/main.cpp)
add_executable(ex6.exe ex6/main.cpp)
add_executable(ex7.exe ex7/main.cpp)
add_executable(ex8.exe ex8/main.cpp)
add_executable(ex9.exe ex9/main.cpp)
add_executable(ex10.exe ex10/main.cpp)
add_executable(ex_basic.exe ex_basic/main.cpp)
add_executable(ex_beta.exe ex_beta/main.cpp)
add_executable(ex_actf.exe ex_actf/main.cpp)
add_executable(ex_propagate.exe ex_propagate/main.cpp)
add_executable(ex_xderiv.exe ex_xderiv/main.cpp)
add_executable(ex_vderiv.exe ex_vderiv/main.cpp)
add_executable(ex_plot.exe ex_plot/main.cpp)
add_executable(ex_loadfile.exe ex_loadfile/main.cpp)
add_executable(ex_fit.exe ex_fit/main.cpp)
add_executable(ex_features.exe ex_features/main.cpp)
40 changes: 20 additions & 20 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,60 +7,60 @@ Some examples might also contain a `plot.py` script to show a plot. It gets call
by `./run.sh` after the executable has terminated, but requires python with matplotlib.


## Example 1
## Basic Example

`ex1/`: construct and modify the geometry of a FFNN (i.e. number of layers and units)
`ex_basic/`: construct and modify the geometry of a FFNN (i.e. number of layers and units)



## Example 2
## Network weights (beta)

`ex2/`: access and modify the beta of a FFNN (i.e. the variational parameters)
`ex_beta/`: access and modify the beta of a FFNN (i.e. the variational parameters)



## Example 3
## Activation Functions

`ex3/`: manage the activation functions
`ex_actf/`: manage the activation functions



## Example 4
## NN Propagation

`ex4/`: compute the output of a FFNN
`ex_propagate/`: compute the output of a FFNN



## Example 5
## Input Derivative

`ex5/`: compute first and second derivative of the NN output in respect to input
`ex_xderiv/`: compute first and second derivative of the NN output in respect to input



## Example 6
## Variational Derivative

`ex6/`: compute first derivative of the NN in respect to the variational parameters (betas)
`ex_vderiv/`: compute first derivative of the NN in respect to the variational parameters (betas)



## Example 7
## Printing and Plotting

`ex7/`: write files for plotting the values and its first and second derivatives of a NN:R->R (1-dimensional function)
`ex_plot/`: write files for plotting the values and its first and second derivatives of a NN:R->R (1-dimensional function)



## Example 8
## Load NN from file

`ex8/`: read FFNN structure from a file
`ex_loadfile/`: read FFNN structure from a file



## Example 9
## Fit NN function to data

`ex9/`: use NNTrainer(GSL) to make FFNN fit a gaussian
`ex_fit/`: use NNTrainer(GSL) to make FFNN fit a gaussian



## Example 10
## Fit a NN with feature map layer

`ex10/`: use a FeatureMapLayer to fit more easily a gaussian of x-y-distance
`ex_features/`: use a FeatureMapLayer to fit more easily a gaussian of x-y-distance
3 changes: 0 additions & 3 deletions examples/ex5/run.sh

This file was deleted.

3 changes: 0 additions & 3 deletions examples/ex6/run.sh

This file was deleted.

3 changes: 0 additions & 3 deletions examples/ex7/run.sh

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion examples/ex1/run.sh → examples/ex_actf/run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
cd ../../build/examples
./ex1.exe
./ex_actf.exe
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/ex3/run.sh → examples/ex_basic/run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
cd ../../build/examples
./ex3.exe
./ex_basic.exe
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/ex4/run.sh → examples/ex_beta/run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
cd ../../build/examples
./ex4.exe
./ex_beta.exe
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/ex10/run.sh → examples/ex_features/run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
(
cd ../../build/examples
./ex10.exe
./ex_features.exe
)
python plot.py
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/ex9/run.sh → examples/ex_fit/run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
(
cd ../../build/examples
./ex9.exe
./ex_fit.exe
)
python plot.py
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/ex8/run.sh → examples/ex_loadfile/run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
cp stored_ffnn.txt ../../build/examples/
cd ../../build/examples
./ex8.exe
./ex_loadfile.exe
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/ex2/run.sh → examples/ex_plot/run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
cd ../../build/examples
./ex2.exe
./ex_plot.exe
File renamed without changes.
3 changes: 3 additions & 0 deletions examples/ex_propagate/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
cd ../../build/examples
./ex_propagate.exe
File renamed without changes.
3 changes: 3 additions & 0 deletions examples/ex_vderiv/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
cd ../../build/examples
./ex_vderiv.exe
File renamed without changes.
3 changes: 3 additions & 0 deletions examples/ex_xderiv/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
cd ../../build/examples
./ex_xderiv.exe
2 changes: 1 addition & 1 deletion test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ ${VALGRIND} ./check
for exe in ./ut*.exe; do
echo
echo "Running test ${exe}..."
${VALGRIND} ${exe}
${VALGRIND} ${exe} || exit 1
echo
done

0 comments on commit 18cc40f

Please sign in to comment.