Repository navigation
Make sure TensorFlow also works on offline machines - #275
Conversation
Signed-off-by: laraPPr <[email protected]>
Signed-off-by: laraPPr <[email protected]>
Signed-off-by: laraPPr <[email protected]>
Signed-off-by: laraPPr <[email protected]>
|
@laraPPr why not first download the dataset in a running a test locally should be doable with the |
|
Mare Nostrum does not have login nodes with internet access. Which is a real pita. |
|
And tensorflow redowloads everytime even when it is cashed. |
did you try adding the |
No I did not try that. Will try it after the meeting. |
Signed-off-by: laraPPr <[email protected]>
Signed-off-by: laraPPr <[email protected]>
…t in configs Signed-off-by: laraPPr <[email protected]>
|
I think we need to update that CI because it is not testing the TensorFlow tests not sure why |
|
Converted to draft because I've now switched the other prs to use features instead of extras |
Signed-off-by: laraPPr <[email protected]>
| 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): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
…hout the data present.
casparvl
left a comment
There was a problem hiding this comment.
I added
FEATURES.OFFLINE,
to our local config. Then, the test got skipped. From the logs:
[2025-10-23T21:45:07] debug: reframe: [check_files_for_offline_run]: Warning: will exclude TensorFlow/2.13.0-foss-2023a tests on offline partitions.
Because reframe could not find ./TensorFlow/2.13.0-foss-2023a/datasets/mnist.npz.
You can download the file running tf.keras.datasets.mnist.load_data() with TensorFlow/2.13.0-foss-2023a on a system with internet access.
Then, I downloaded the dataset. Since I don't set a resourcesdir explicitly in my ReFrame config, it's using the current directory as default. Unfortunately, in load_data(path=...) the path is relative to the .keras/datasets folder according to the documentation https://www.tensorflow.org/api_docs/python/tf/keras/datasets/mnist/load_data#args. Fortunately, a full path is respected, so I could download it using:
mkdir -p TensorFlow/2.13.0-foss-2023a/datasets
python -c "import tensorflow as tf; tf.keras.datasets.mnist.load_data(path='/home/casparl/EESSI/test-suite/TensorFlow/2.13.0-foss-2023a/datasets/mnist.npz')"
Note the mkdir -p: the directory needs to exist, otherwise you get a FileNotFoundError.
I think we should improve the instruction so that it prints these exact commands. ReFrame knows what it's own resourcesdir is, we can print that as part of the path.
Now the bad news: rerunning still gives me:
debug: reframe: [check_files_for_offline_run]: Warning: will exclude TensorFlow/2.13.0-foss-2023a tests on offline partitions.
Because reframe could not find ./TensorFlow/2.13.0-foss-2023a/datasets/mnist.npz.
You can download the file running tf.keras.datasets.mnist.load_data() with TensorFlow/2.13.0-foss-2023a on a system with internet access.
Reason is that the current working dir for a test is the location of the test file:
[2025-10-23T22:13:16] debug: reframe: [check_files_for_offline_run]: Current working dir: /gpfs/home4/casparl/EESSI/test-suite/eessi/testsuite/tests/apps/tensorflow
[2025-10-23T22:13:16] debug: reframe: [check_files_for_offline_run]: Warning: will exclude TensorFlow/2.13.0-foss-2023a tests on offline partitions.
That's another reason why it's useful if it gets printed from the test itself: if the resourcesdir is ., it can use os.getcwd() instead.
…e warning visible on stdout, not just in the log - because there it is too hidden. Finally, make sure to _only_ print the warning if there is _at least_ one offline partition
|
After 1019f21 I now ran again and got: Then, I copy-pasted the instructions: and ran again: I also checked that the warning does not get printed if none of the partitions in the current system have I do wonder two things:
|
|
I'm also not sure why I get this redefinition issue in flake8. The line number seems wrong, and I really don't see a redefinition? |
|
On suggestion number 2. That is what I had in the first place. Than you suggested that we should do it as is now. I think I'm fine with both but I'd rather not go back and forth. |
|
to avoid the verbosity, maybe we should only print the instructions when f'Excluding {self.name} on offline partition {self.current_partition.name}, use `--verbose` for pre-download instructions'as another alternative, we could add a |
I know you did and I hate reviewers that keep changing their mind ;-) The issue that I have now - and did not foresee - is: how do you make sure that warning is visible when it's needed (i.e. not hidden in the logs), but not spammed when it's not needed? With the current setup, it'll warn you if there is an offline partition in your system even if that's not the one you've told reframe to run on. The easiest solution is to print it only if the current partition is offline, but that would require going back to the
I like this, but it's irrespective of whether we should move back to a 'skip_if' or not. But it's a good way to make the default message shorter. What I was really hoping @smoors would say is that 'yes, printing it once is easy with globals'. Then, I'd do that and keep the current approach. XD I'm really on the fence between moving back to a |
|
How about we make something like this |
|
i've implemented a note that i had to use |
Oh good point, forgot about that... But I'd say indeed |
casparvl
left a comment
There was a problem hiding this comment.
TLDR: approved!
Tested that the warning only gets printed once:
(eessi_test_venv) [casparl@int6 test-suite]$ reframe -c eessi/testsuite/tests/apps/tensorflow/ --run --system snellius:rome
[ReFrame Setup]
version: 4.7.0-dev.3+20ccf7af
command: '/gpfs/home4/casparl/EESSI/eessi_test_venv/bin/reframe -c eessi/testsuite/tests/apps/tensorflow/ --run --system snellius:rome'
launched by: [email protected]
working directory: '/gpfs/home4/casparl/EESSI/test-suite'
settings files: '<builtin>', '/gpfs/home4/casparl/EESSI/test-suite/config/surf_snellius.py'
check search path: (R) '/gpfs/home4/casparl/EESSI/test-suite/eessi/testsuite/tests/apps/tensorflow'
stage directory: '/scratch-shared/casparl/reframe_output/staging'
output directory: '/gpfs/home4/casparl/EESSI/reframe_runs/output'
log files: '/gpfs/home4/casparl/EESSI/reframe_runs/logs/reframe_20251106_133851.log'
== Temporary log file in case of crash /scratch-local/45397/eb-8joat2kq/easybuild-4w0hya03.log
WARNING: Some partitions are labeled offline and will be excluded from EESSI_TensorFlow,
because ReFrame could not find the data at /gpfs/home4/casparl/EESSI/test-suite/eessi/testsuite/tests/apps/tensorflow/TensorFlow/2.13.0-foss-2023a/datasets/mnist.npz.
To pre-download the data, please run (on a system with internet access):
mkdir -p /gpfs/home4/casparl/EESSI/test-suite/eessi/testsuite/tests/apps/tensorflow/TensorFlow/2.13.0-foss-2023a/datasets
module load TensorFlow/2.13.0-foss-2023a
python -c "import tensorflow as tf; tf.keras.datasets.mnist.load_data('/gpfs/home4/casparl/EESSI/test-suite/eessi/testsuite/tests/apps/tensorflow/TensorFlow/2.13.0-foss-2023a/datasets/mnist.npz')"
[==========] Running 0 check(s)
[==========] Started on Thu Nov 6 13:38:53 2025+0100
[----------] start processing checks
[----------] all spawned checks have finished
[ PASSED ] Ran 0/0 test case(s) from 0 check(s) (0 failure(s), 0 skipped, 0 aborted)
[==========] Finished on Thu Nov 6 13:38:53 2025+0100
Log file(s) saved in '/gpfs/home4/casparl/EESSI/reframe_runs/logs/reframe_20251106_133851.log'
Tested the download instructions and then rerunning:
$ mkdir -p /gpfs/home4/casparl/EESSI/test-suite/eessi/testsuite/tests/apps/tensorflow/TensorFlow/2.13.0-foss-2023a/datasets
module load TensorFlow/2.13.0-foss-2023a
python -c "import tensorflow as tf; tf.keras.datasets.mnist.load_data('/gpfs/home4/casparl/EESSI/test-suite/eessi/testsuite/tests/apps/tensorflow/TensorFlow/2.13.0-foss-2023a/datasets/mnist.npz')"
Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/mnist.npz
11490434/11490434 [==============================] - 1s 0us/step
$ module purge
$ module load EESSI
Module for EESSI/2023.06 loaded successfully
$ reframe -c eessi/testsuite/tests/apps/tensorflow/ --run --system snellius:rome -t 1_node
[ReFrame Setup]
version: 4.7.0-dev.3+20ccf7af
command: '/gpfs/home4/casparl/EESSI/eessi_test_venv/bin/reframe -c eessi/testsuite/tests/apps/tensorflow/ --run --system snellius:rome -t 1_node'
launched by: [email protected]
working directory: '/gpfs/home4/casparl/EESSI/test-suite'
settings files: '<builtin>', '/gpfs/home4/casparl/EESSI/test-suite/config/surf_snellius.py'
check search path: (R) '/gpfs/home4/casparl/EESSI/test-suite/eessi/testsuite/tests/apps/tensorflow'
stage directory: '/scratch-shared/casparl/reframe_output/staging'
output directory: '/gpfs/home4/casparl/EESSI/reframe_runs/output'
log files: '/gpfs/home4/casparl/EESSI/reframe_runs/logs/reframe_20251106_133701.log'
== Temporary log file in case of crash /scratch-local/45397/eb-9sbjju2p/easybuild-rkfbtw2u.log
[==========] Running 1 check(s)
[==========] Started on Thu Nov 6 13:37:04 2025+0100
[----------] start processing checks
[ RUN ] EESSI_TensorFlow %scale=1_node %module_name=TensorFlow/2.13.0-foss-2023a %device_type=cpu /9864d0f5 @snellius:rome+default
[ OK ] (1/1) EESSI_TensorFlow %scale=1_node %module_name=TensorFlow/2.13.0-foss-2023a %device_type=cpu /9864d0f5 @snellius:rome+default
P: perf: 60312.18172813244 img/s (r:0, l:None, u:None)
[----------] all spawned checks have finished
[ PASSED ] Ran 1/1 test case(s) from 1 check(s) (0 failure(s), 0 skipped, 0 aborted)
[==========] Finished on Thu Nov 6 13:37:55 2025+0100
Log file(s) saved in '/gpfs/home4/casparl/EESSI/reframe_runs/logs/reframe_20251106_133701.log'
Perfect!
Depends on the new hook in this pr