diff --git a/advanced/algorithms/username/gpu_test/1.json b/advanced/algorithms/username/gpu_test/1.json new file mode 100644 index 0000000000000000000000000000000000000000..3744b518446e266828a5579f9d7ba3e9f634df1b --- /dev/null +++ b/advanced/algorithms/username/gpu_test/1.json @@ -0,0 +1,30 @@ +{ + "type": "sequential", + "groups": [ + { + "outputs": { + "scores": { + "type": "{{ user.username }}/probe_scores/1" + } + }, + "inputs": { + "client_id": { + "type": "{{ system_user.username }}/uint64/1" + } + }, + "name": "main" + } + ], + "parameters": { + "offset": { + "type": "uint32", + "default": 10, + "description": "Offset" + } + }, + "schema_version": 2, + "api_version": 2, + "description": "", + "splittable": false, + "language": "python" +} diff --git a/advanced/algorithms/username/gpu_test/1.py b/advanced/algorithms/username/gpu_test/1.py new file mode 100644 index 0000000000000000000000000000000000000000..149dc2e569813d4cf0567885cb81e9da9b381418 --- /dev/null +++ b/advanced/algorithms/username/gpu_test/1.py @@ -0,0 +1,61 @@ +############################################################################### +# # +# Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/ # +# Contact: beat.support@idiap.ch # +# # +# This file is part of the beat.examples module of the BEAT platform. # +# # +# Commercial License Usage # +# Licensees holding valid commercial BEAT licenses may use this file in # +# accordance with the terms contained in a written agreement between you # +# and Idiap. For further information contact tto@idiap.ch # +# # +# Alternatively, this file may be used under the terms of the GNU Affero # +# Public License version 3 as published by the Free Software and appearing # +# in the file LICENSE.AGPL included in the packaging of this file. # +# The BEAT platform is distributed in the hope that it will be useful, but # +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # +# or FITNESS FOR A PARTICULAR PURPOSE. # +# # +# You should have received a copy of the GNU Affero Public License along # +# with the BEAT platform. If not, see http://www.gnu.org/licenses/. # +# # +############################################################################### + +import numpy +import torch + +class Algorithm: + + def __init__(self): + self.offset = 1 + + def setup(self, parameters): + self.offset = numpy.asscalar(parameters['offset']) + return torch.cuda.is_available() + + def process(self, inputs, data_loaders, outputs): + client_id = inputs['client_id'].data.value + + x = torch.FloatTensor(1, 1).fill_(numpy.asscalar(client_id)).cuda() + y = torch.FloatTensor(1, 1).fill_(self.offset).cuda() + z = x + y + score = z.cpu().numpy().astype(numpy.int32)[0][0] + + scores = [ + { + 'template_identity': client_id, + 'score': score if client_id % 2 else -score + }, + { + 'template_identity': 0, + 'score': -score if client_id % 2 else score + } + ] + + outputs['scores'].write({ + 'client_identity': client_id, + 'scores': scores + }) + + return True diff --git a/advanced/algorithms/username/gpu_test/1.rst b/advanced/algorithms/username/gpu_test/1.rst new file mode 100644 index 0000000000000000000000000000000000000000..3d94c664f22939a845fd14ae04420d9c367d589e --- /dev/null +++ b/advanced/algorithms/username/gpu_test/1.rst @@ -0,0 +1,22 @@ +.. Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/ .. +.. Contact: beat.support@idiap.ch .. +.. .. +.. This file is part of the beat.examples module of the BEAT platform. .. +.. .. +.. Commercial License Usage .. +.. Licensees holding valid commercial BEAT licenses may use this file in .. +.. accordance with the terms contained in a written agreement between you .. +.. and Idiap. For further information contact tto@idiap.ch .. +.. .. +.. Alternatively, this file may be used under the terms of the GNU Affero .. +.. Public License version 3 as published by the Free Software and appearing .. +.. in the file LICENSE.AGPL included in the packaging of this file. .. +.. The BEAT platform is distributed in the hope that it will be useful, but .. +.. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY .. +.. or FITNESS FOR A PARTICULAR PURPOSE. .. +.. .. +.. You should have received a copy of the GNU Affero Public License along .. +.. with the BEAT platform. If not, see http://www.gnu.org/licenses/. .. + + +Minimal algorithm validating GPU setup. \ No newline at end of file diff --git a/advanced/algorithms/username/pca/1.json b/advanced/algorithms/username/pca/1.json index 0f5922647fa032d23cd583cdf659f5e23494f128..86e6aafd38245fd1b28c18f47bc4417c828ecd75 100644 --- a/advanced/algorithms/username/pca/1.json +++ b/advanced/algorithms/username/pca/1.json @@ -20,7 +20,7 @@ "number-of-components": { "default": 5, "type": "uint32", - "number-of-components": "the number of dimensions to retain after applying PCA" + "description": "the number of dimensions to retain after applying PCA" } } } diff --git a/advanced/experiments/username/username/gpu_test/1/gpu_test.json b/advanced/experiments/username/username/gpu_test/1/gpu_test.json new file mode 100644 index 0000000000000000000000000000000000000000..28f60c51afff89bc5fee14b0e6adafdc1ff68616 --- /dev/null +++ b/advanced/experiments/username/username/gpu_test/1/gpu_test.json @@ -0,0 +1,44 @@ +{ + "blocks": { + "block_1": { + "outputs": { + "scores": "scores" + }, + "algorithm": "{{ user.username }}/gpu_test/1", + "inputs": { + "client_id": "input" + } + } + }, + "globals": { + "queue": "{{ queue }}", + "{{ user.username }}/gpu_test/1": { + "offset": 10 + }, + "environment": { + "version": "0.0.1", + "name": "Pytorch 0.4.0" + } + }, + "analyzers": { + "analyzer_1": { + "nb_slots": 1, + "algorithm": "{{ user.username }}/postperf_iso/1", + "inputs": { + "scores": "scores" + }, + "queue": "{{ queue }}", + "environment": { + "version": "{{ environment.version }}", + "name": "{{ environment.name }}" + } + } + }, + "datasets": { + "templates": { + "set": "templates", + "protocol": "idiap", + "database": "atnt/5" + } + } +} \ No newline at end of file diff --git a/advanced/toolchains/username/gpu_test/1.json b/advanced/toolchains/username/gpu_test/1.json new file mode 100644 index 0000000000000000000000000000000000000000..f2074994abc0208e9408a41764003b9d95765f49 --- /dev/null +++ b/advanced/toolchains/username/gpu_test/1.json @@ -0,0 +1,109 @@ +{ + "connections": [ + { + "to": "analyzer_1.scores", + "from": "block_1.scores", + "channel": "templates" + }, + { + "to": "block_1.input", + "from": "templates.file_id", + "channel": "templates" + } + ], + "analyzers": [ + { + "inputs": [ + "scores" + ], + "synchronized_channel": "templates", + "name": "analyzer_1" + } + ], + "datasets": [ + { + "outputs": [ + "client_id", + "file_id", + "image", + "template_id" + ], + "name": "templates" + } + ], + "blocks": [ + { + "inputs": [ + "input" + ], + "synchronized_channel": "templates", + "name": "block_1", + "outputs": [ + "scores" + ] + } + ], + "representation": { + "connections": { + "templates.file_id/block_1.input": [ + { + "col": 9, + "row": 6 + }, + { + "col": 10, + "row": 6 + }, + { + "col": 14, + "row": 6 + }, + { + "col": 15, + "row": 6 + } + ], + "block_1.scores/analyzer_1.scores": [ + { + "col": 21, + "row": 6 + }, + { + "col": 22, + "row": 6 + }, + { + "col": 24, + "row": 6 + }, + { + "col": 25, + "row": 6 + } + ] + }, + "blocks": { + "templates": { + "width": 5, + "height": 6, + "col": 4, + "row": 3 + }, + "block_1": { + "width": 6, + "height": 3, + "col": 15, + "row": 4 + }, + "analyzer_1": { + "width": 6, + "height": 3, + "col": 25, + "row": 4 + } + }, + "channel_colors": { + "templates": "#0000FF" + } + } +} diff --git a/advanced/toolchains/username/gpu_test/1.rst b/advanced/toolchains/username/gpu_test/1.rst new file mode 100644 index 0000000000000000000000000000000000000000..5812fdd1452853abcef387fd2246bd6247e20d0d --- /dev/null +++ b/advanced/toolchains/username/gpu_test/1.rst @@ -0,0 +1,22 @@ +.. Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/ .. +.. Contact: beat.support@idiap.ch .. +.. .. +.. This file is part of the beat.examples module of the BEAT platform. .. +.. .. +.. Commercial License Usage .. +.. Licensees holding valid commercial BEAT licenses may use this file in .. +.. accordance with the terms contained in a written agreement between you .. +.. and Idiap. For further information contact tto@idiap.ch .. +.. .. +.. Alternatively, this file may be used under the terms of the GNU Affero .. +.. Public License version 3 as published by the Free Software and appearing .. +.. in the file LICENSE.AGPL included in the packaging of this file. .. +.. The BEAT platform is distributed in the hope that it will be useful, but .. +.. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY .. +.. or FITNESS FOR A PARTICULAR PURPOSE. .. +.. .. +.. You should have received a copy of the GNU Affero Public License along .. +.. with the BEAT platform. If not, see http://www.gnu.org/licenses/. .. + + +Implements a simple pass through for validating GPU setup. \ No newline at end of file diff --git a/test/algorithms/username/integers_add_torch_autonomous/1.json b/test/algorithms/username/integers_add_torch_autonomous/1.json index 09b49e7f1d20b1fd24480cdb37136c06a45ce9fe..adec321a34a22cdf735a9c1856cab52b73f066c3 100644 --- a/test/algorithms/username/integers_add_torch_autonomous/1.json +++ b/test/algorithms/username/integers_add_torch_autonomous/1.json @@ -20,7 +20,7 @@ ], "parameters": { "offset": { - "default": "1", + "default": 1, "type": "int32" } }, diff --git a/test/algorithms/username/integers_add_torch_legacy/1.json b/test/algorithms/username/integers_add_torch_legacy/1.json index e59a0ec1632963019b22843dfea528b24a86cde5..578d04b6e07d6357ff0af28745baa5b3bad00e12 100644 --- a/test/algorithms/username/integers_add_torch_legacy/1.json +++ b/test/algorithms/username/integers_add_torch_legacy/1.json @@ -18,7 +18,7 @@ ], "parameters": { "offset": { - "default": "1", + "default": 1, "type": "int32" } }, diff --git a/test/algorithms/username/integers_add_torch_sequential/1.json b/test/algorithms/username/integers_add_torch_sequential/1.json index 74bca6f7cd40b562a7170cdd16a93a969a8d9c81..67a0153ae07b3a30d27f802f150b9b6b2bb433c3 100644 --- a/test/algorithms/username/integers_add_torch_sequential/1.json +++ b/test/algorithms/username/integers_add_torch_sequential/1.json @@ -20,7 +20,7 @@ ], "parameters": { "offset": { - "default": "1", + "default": 1, "type": "int32" }, "sync": {