Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
deed7dd
First try to work around needing to download the dataset fom tensorfl…
laraPPr Jul 10, 2025
f4ecb2d
work in progress make tensorflow test also work ofline
laraPPr Jul 10, 2025
6287c7d
Merge branch 'EESSI:main' into TensorFlow_offline
laraPPr Jul 10, 2025
7bc7a52
use general path where to find downloaded files
laraPPr Jul 14, 2025
230e097
make pyhton linter happy
laraPPr Jul 14, 2025
caeb24f
make pyhton linter happy
laraPPr Jul 14, 2025
b81c8d1
remove comment
laraPPr Jul 14, 2025
5a5f921
remove double code
laraPPr Jul 18, 2025
9bd0041
use EESSI_TEST_SUITE_DISABLE_DOWNLOAD
laraPPr Jul 18, 2025
be06cc1
use current_partition and current_system and set the neccesary env_vars
laraPPr Jul 31, 2025
b44b73f
use path= in mnist.load_data()
laraPPr Jul 31, 2025
93da4f1
implement skip when data cannot be found
laraPPr Jul 31, 2025
e3d4c3f
split too long line
laraPPr Jul 31, 2025
760ba53
remove unneccessary f-string
laraPPr Jul 31, 2025
a009ca9
Make sure that test-suite works when EXTRAS.INTERNET_ACCESS is not se…
laraPPr Jul 31, 2025
4ee9ae6
use features instead of extras
laraPPr Aug 14, 2025
9a0e41a
Make sure the test is not setup when running on an offline system wit…
laraPPr Aug 18, 2025
e69a372
We need this new constant in this feature branch in order to test it
Oct 23, 2025
919f4fd
Add -offline to valid_systems if a test requires nodes that are online
Oct 23, 2025
1019f21
Use FEATURES.OFFLINE in hooks (as we were supposed to). Also, make th…
Oct 23, 2025
27bd6e6
Fix a flake8 issue
Oct 23, 2025
ba0e4f8
random change
Oct 27, 2025
4c19d5c
Merge branch 'main' into pr275
Oct 27, 2025
5e73445
remove duplicate function
Oct 27, 2025
a405baf
use log_once function
Oct 30, 2025
28748e3
remove unneeded gobal usage
Oct 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion eessi/testsuite/tests/apps/tensorflow/src/mnist_setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
import os

import tensorflow as tf
import numpy as np

if os.environ.get('EESSI_TEST_SUITE_DISABLE_DOWNLOAD') == 'True':
eessi_test_suite_download = False
else:
eessi_test_suite_download = True


def mnist_dataset(batch_size, test_batch_size):
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
if eessi_test_suite_download:
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
else:
tensorflow_data = os.environ['RFM_TENSORFLOW_DATA']
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data(path=tensorflow_data)
# The `x` arrays are in uint8 and have values in the [0, 255] range.
# You need to convert them to float32 with values in the [0, 1] range.
x_train = x_train / np.float32(255)
Expand Down
19 changes: 19 additions & 0 deletions eessi/testsuite/tests/apps/tensorflow/tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
The test itself is based on an official multi-worker with Keras tutoral at
https://www.tensorflow.org/tutorials/distribute/multi_worker_with_keras
"""
import os

import reframe as rfm
from reframe.core.builtins import deferrable, parameter, run_after, sanity_function, performance_function
Expand Down Expand Up @@ -97,3 +98,21 @@ def set_thread_count_args(self):
self.executable_opts += ['--intra-op-parallelism', '%s' % self.num_cpus_per_task]
self.executable_opts += ['--inter-op-parallelism', '1']
utils.log(f'executable_opts set to {self.executable_opts}')

@run_after('setup')
def set_up_offline_run(self):
"""
Set environments variables to run offline or skip the test
"""
if 'offline' in self.current_partition.features:
resourcesdir = self.current_system.resourcesdir
data = os.path.join(resourcesdir, self.module_name, 'datasets/mnist.npz')
if os.path.exists(data):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See if we can move this check to the after_init state. If so, and if this path does not exist, add -offline to the valid_systems.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've now split the funtion up in two. The first runs after init to check if the data is their and will set the necessary environment variable if it is. If not valid_systems gets edited with the new hook from #279. The other function is still required to run after setup because we need self.current_partition.features.

self.env_vars['EESSI_TEST_SUITE_DISABLE_DOWNLOAD'] = 'True'
self.env_vars['RFM_TENSORFLOW_DATA'] = data
else:
msg = f'{self.current_partition.name} does not have internet access. '
msg += f'And could not find {data}. '
msg += 'You can download the file running tf.keras.datasets.mnist.load_data() '
msg += f'with {self.module_name} on a system with internet access.'
self.skip_if(self.module_name == self.module_name, msg)