Skip to content

Commit 4e3a68a

Browse files
committed
Merge remote-tracking branch 'origin/master' into cuda
2 parents 1779366 + 975316a commit 4e3a68a

File tree

93 files changed

+1728
-3642
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1728
-3642
lines changed

.devcontainer/Dockerfile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
1919
libsm6 \
2020
libxext6 \
2121
moreutils \
22+
ninja-build \
23+
patchelf \
2224
python3 \
2325
python3-dev \
2426
python3-pip \
2527
python3-tk \
28+
python3-venv \
2629
software-properties-common \
2730
sudo \
2831
vim \
@@ -33,10 +36,18 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
3336
RUN pip install --upgrade pip \
3437
&& hash -r pip3 \
3538
&& pip install \
39+
auditwheel \
40+
build \
3641
cmake \
3742
conan==1.* \
43+
ipympl \
44+
ipykernel \
45+
ipywidgets \
46+
h5py \
3847
matplotlib \
39-
numpy
48+
numpy \
49+
twine \
50+
wheel
4051

4152
ARG USERNAME=vscode
4253
ARG USER_UID=15005

.devcontainer/devcontainer.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@
1515
"customizations": {
1616
"vscode": {
1717
"extensions": [
18-
"ms-vscode.cpptools-extension-pack"
18+
"ms-vscode.cpptools-extension-pack",
19+
"ms-python.python",
20+
"ms-toolsai.jupyter",
21+
"tamasfe.even-better-toml",
1922
]
2023
}
21-
}
24+
},
25+
"mounts": [
26+
"source=${localEnv:HOME}/data/machine-learning,target=/data,type=bind,consistency=cached"
27+
]
2228
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
/src/UtilitiesLib/Version.h
1515
/test-man
1616
jupyter/.env
17+
_skbuild/

.vscode/extensions.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"kriegalex.vscode-cudacpp",
55
"ms-python.python",
66
"ms-vscode.cmake-tools",
7+
"ms-vscode.cpptools-extension-pack",
78
"ms-vscode.cpptools",
8-
"twxs.cmake"
9+
"tamasfe.even-better-toml",
10+
"mhutchie.git-graph"
911
]
10-
}
12+
}

.vscode/settings.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
2-
"C_Cpp.dimInactiveRegions": false,
2+
"cmake.configureSettings": {
3+
"CMAKE_VERBOSE_MAKEFILE": "OFF"
4+
},
5+
"cmake.generator": "Ninja",
36
"files.associations": {
47
"*.cuh": "cpp"
5-
}
8+
},
69
}

CMakeLists.txt

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,20 @@ find_program(CONAN conan)
7171
if(CONAN)
7272
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
7373
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
74-
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/v0.16.1/conan.cmake"
74+
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/0.18.1/conan.cmake"
7575
"${CMAKE_BINARY_DIR}/conan.cmake"
7676
TLS_VERIFY ON)
7777
endif()
7878

7979
include(${CMAKE_BINARY_DIR}/conan.cmake)
80-
conan_cmake_run(CONANFILE conanfile.py
81-
BASIC_SETUP CMAKE_TARGETS NO_OUTPUT_DIRS
82-
SETTINGS compiler.libcxx=libstdc++11
83-
BUILD missing)
84-
85-
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
86-
set(CONAN_SYSTEM_INCLUDES "On")
87-
conan_basic_setup(NO_OUTPUT_DIRS)
80+
81+
conan_cmake_configure(REQUIRES gtest/1.13.0 pybind11/2.10.4
82+
GENERATORS cmake_find_package)
83+
conan_cmake_autodetect(settings)
84+
conan_cmake_install(PATH_OR_REFERENCE .
85+
BUILD missing
86+
REMOTE conancenter
87+
SETTINGS ${settings})
8888
endif()
8989

9090
# Get Git revision
@@ -146,7 +146,7 @@ find_package(pybind11)
146146
add_subdirectory(src)
147147

148148
find_package(GTest)
149-
if(GTEST_FOUND)
149+
if(GTEST_FOUND AND (NOT DEFINED SKBUILD))
150150
ENABLE_TESTING()
151151
add_subdirectory(test)
152152
endif()
@@ -163,16 +163,20 @@ if(DOXYGEN_FOUND)
163163
)
164164
endif()
165165

166-
install(DIRECTORY scripts/
167-
DESTINATION scripts
168-
FILES_MATCHING PATTERN "*.py"
169-
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
170-
GROUP_EXECUTE GROUP_READ
171-
WORLD_EXECUTE WORLD_READ
172-
)
166+
if(DEFINED SKBUILD)
167+
install(FILES python/pink/tools.py python/pink/__init__.py DESTINATION pink)
168+
else()
169+
install(DIRECTORY python/
170+
DESTINATION python
171+
FILES_MATCHING PATTERN "*.py"
172+
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
173+
GROUP_EXECUTE GROUP_READ
174+
WORLD_EXECUTE WORLD_READ
175+
)
176+
endif()
173177

174178
if(UNIX)
175-
set(CPACK_CMAKE_GENERATOR "Unix Makefiles")
179+
set(CPACK_CMAKE_GENERATOR "Ninja")
176180
set(CPACK_SOURCE_GENERATOR "TGZ;TBZ2")
177181
set(CPACK_GENERATOR "TGZ;TBZ2;DEB;RPM")
178182
set(CPACK_PACKAGE_MAINTAINER "Bernd Doser")

MANIFEST.in

Lines changed: 0 additions & 6 deletions
This file was deleted.

README-dev.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# For developers
2+
3+
## Create PyPI package
4+
5+
```
6+
python3 -m build
7+
8+
python3 -m wheel unpack dist/astro_pink-2.5-cp310-cp310-manylinux_2_35_x86_64.whl
9+
cd astro_pink-2.5/
10+
patchelf --set-rpath '$ORIGIN/lib' pink.cpython-310-x86_64-linux-gnu.so
11+
ldd pink.cpython-310-x86_64-linux-gnu.so
12+
cd ..
13+
python3 -m wheel pack astro_pink-2.5
14+
mv astro_pink-2.5-cp310-cp310-manylinux_2_35_x86_64.whl dist/
15+
16+
python3 -m twine upload --repository [pypi|testpypi] dist/*
17+
```
18+
19+
### Overwrite deployed wheels
20+
21+
It is not allowed to upload the same filename twice to testpypi or pypi.
22+
Therefore, build numbers can be used:
23+
24+
```
25+
astro_pink-2.5-cp310-cp310-manylinux_2_35_x86_64.whl
26+
astro_pink-2.5-1-cp310-cp310-manylinux_2_35_x86_64.whl
27+
astro_pink-2.5-2-cp310-cp310-manylinux_2_35_x86_64.whl
28+
```
29+
30+
31+
## Manylinux container
32+
33+
docker run -it -v $PWD:/work -w /work bernddoser/manylinux2010-cuda /bin/bash
34+
35+
/opt/python/cp37-cp37m/bin/pip install -U auditwheel
36+
37+
/opt/python/<python version>/bin/pip wheel -v . -w output
38+
39+
40+
41+
## Useful commands for debugging
42+
43+
```
44+
auditwheel repair astro_pink-2.4.1-cp36-cp36m-linux_x86_64.whl
45+
auditwheel show wheelhouse/astro_pink-2.4.1-cp36-cp36m-manylinux2010_x86_64.whl
46+
```
47+
```
48+
ldd pink.cpython-36m-x86_64-linux-gnu.so
49+
readelf -d pink.cpython-36m-x86_64-linux-gnu.so
50+
```
51+
```
52+
/opt/python/cp37-cp37m/bin/wheel unpack astro_pink-2.4.1-cp36-cp36m-manylinux2010_x86_64.whl
53+
cd astro_pink-2.4.1
54+
mv libCudaLib.so libPythonBindingLib.so astro_pink.libs
55+
cd ..
56+
/opt/python/cp37-cp37m/bin/wheel pack astro_pink-2.4.1
57+
```

README.md

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
[![Join the chat at https://gitter.im/HITS-AIN-PINK/Lobby](https://badges.gitter.im/HITS-AIN-PINK/Lobby.svg)](https://gitter.im/HITS-AIN-PINK/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
33
<a href="http://ascl.net/1910.001"><img src="https://img.shields.io/badge/ascl-1910.001-blue.svg?colorB=262255" alt="ascl:1910.001" /></a>
44
[![PyPI version](https://badge.fury.io/py/astro-pink.svg)](https://badge.fury.io/py/astro-pink)
5+
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/BerndDoser/PINK/blob/pypi/colab/pink-train-demo.ipynb)
6+
57

68
# Parallelized rotation and flipping INvariant Kohonen maps (PINK)
79

@@ -73,30 +75,6 @@ For conversion and visualization of images and SOM some python scripts are avail
7375
- train.py: SOM training using the PINK Python interface
7476

7577

76-
## Benchmarks
77-
78-
The input data for the SOM training are radio-synthesis images of Radio Galaxy Zoo containing 176750 images of the dimension 124x124.
79-
The SOM layout is hexagonal of the dimension 21x21 which has 331 neurons (see image above). The size of the neurons is 64x64.
80-
The accuracy for the rotational invariance is 1 degree and the flip invariance is used.
81-
82-
| | PINK 1 | Pink 2 |
83-
| :--- | ---: | ---: |
84-
| CPU-1 | | 35373 |
85-
| CPU-1 + NVIDIA Tesla P40 | 3069 | 909 |
86-
| CPU-1 + 2x NVIDIA Tesla P40 | 2069 | 636 |
87-
| CPU-1 + 4x NVIDIA Tesla P40 | 1891 | 858 |
88-
| CPU-2 + NVIDIA RTX 2080 | | 673 |
89-
| CPU-3 + NVIDIA GTX 750 Ti | | 7185 |
90-
| CPU-4 + 2x NVIDIA RTX 2080 SUPER |       |   477 |
91-
92-
All times are in seconds.
93-
94-
- CPU-1: Intel Gold 5118 (2 sockets, 12 physical cores per socket)
95-
- CPU-2: Intel Core i7-8700K (1 socket, 6 physical cores per socket)
96-
- CPU-3: Intel Core i7-4790K (1 socket, 4 physical cores per socket)
97-
- CPU-4: Intel Gold 6230 (1 socket, 20 physical cores per socket)
98-
99-
10078
## Publication
10179

10280
[Kai Lars Polsterer](https://github.com/kai-polsterer), Fabian Gieseke, Christian Igel,

benchmark.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Benchmark
2+
3+
## Demo Shapes
4+
5+
Data dim: (4000, 64, 64)
6+
SOM dim: (8, 8)
7+
Rotations: 360
8+
GPU: RTX 2080
9+
10+
| Execution | s/it |
11+
|:--------- | ---:|
12+
| binary with CUDA [^1] | 7 |
13+
| binary without CUDA [^2] | 135 |
14+
| train.py [^3] | 127 |
15+
| colab demo without CUDA | 127 |
16+
| colab demo without CUDA @ colab.research.google.com | 170 |
17+
18+
[^1]
19+
```
20+
./build/bin/Pink --train /data/pink/shapes_v2.bin som.bin --som-width 8 --som-height 8
21+
```
22+
23+
[^2] `--cuda-off`
24+
25+
[^3]
26+
```
27+
./python/pink/train.py /data/pink/shapes/* -v
28+
```
29+
30+
31+
## Radio Galaxy Zoo
32+
33+
Data (176750, 124, 124)
34+
SOM (21, 21)
35+
36+
The input data for the SOM training are radio-synthesis images of Radio Galaxy Zoo containing 176750 images of the dimension 124x124.
37+
The SOM layout is hexagonal of the dimension 21x21 which has 331 neurons (see image above). The size of the neurons is 64x64.
38+
The accuracy for the rotational invariance is 1 degree and the flip invariance is used.
39+
40+
| | PINK 1 | PINK 2 |
41+
| :--- | ---: | ---: |
42+
| CPU-1 | | 35373 |
43+
| CPU-1 + NVIDIA Tesla P40 | 3069 | 909 |
44+
| CPU-1 + 2x NVIDIA Tesla P40 | 2069 | 636 |
45+
| CPU-1 + 4x NVIDIA Tesla P40 | 1891 | 858 |
46+
| CPU-2 + NVIDIA RTX 2080 | | 673 |
47+
| CPU-3 + NVIDIA GTX 750 Ti | | 7185 |
48+
| CPU-4 + 2x NVIDIA RTX 2080 SUPER |       |   477 |
49+
50+
All times are in seconds.
51+
52+
- CPU-1: Intel Gold 5118 (2 sockets, 12 physical cores per socket)
53+
- CPU-2: Intel Core i7-8700K (1 socket, 6 physical cores per socket)
54+
- CPU-3: Intel Core i7-4790K (1 socket, 4 physical cores per socket)
55+
- CPU-4: Intel Gold 6230 (1 socket, 20 physical cores per socket)

colab/pink-train-demo.ipynb

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

jupyter/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

jupyter/README.md

Lines changed: 0 additions & 20 deletions
This file was deleted.
File renamed without changes.

jupyter/chmod_notebooks.sh

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)