Skip to content
Snippets Groups Projects
Commit 2019c6f6 authored by valentin.emiya's avatar valentin.emiya
Browse files

doc

parent c4fb1342
No related branches found
No related tags found
No related merge requests found
Pipeline #6066 passed
...@@ -5,13 +5,15 @@ ...@@ -5,13 +5,15 @@
""" """
import numpy as np import numpy as np
from yafe import Experiment
from tffpy.datasets import get_mix, get_dataset
from tffpy.experiments.exp_solve_tff import SolveTffExperiment from tffpy.experiments.exp_solve_tff import SolveTffExperiment
class VarianceExperiment(SolveTffExperiment): class VarianceExperiment(SolveTffExperiment):
"""
A variant of the main experiment (`SolveTffExperiment`) in order to
analyze the variability of results with respect to the randomness of
rand-EVD, by generating 100 draws for the same pair of signals (bird+car).
"""
def __init__(self, force_reset=False, suffix=''): def __init__(self, force_reset=False, suffix=''):
SolveTffExperiment.__init__(self, SolveTffExperiment.__init__(self,
force_reset=force_reset, force_reset=force_reset,
...@@ -45,7 +47,6 @@ class VarianceExperiment(SolveTffExperiment): ...@@ -45,7 +47,6 @@ class VarianceExperiment(SolveTffExperiment):
def get_experiment(setting='full', force_reset=False): def get_experiment(setting='full', force_reset=False):
assert setting in ('full', 'light') assert setting in ('full', 'light')
dataset = get_dataset()
# Set task parameters # Set task parameters
data_params = dict(loc_source='bird', data_params = dict(loc_source='bird',
wideband_src='car') wideband_src='car')
......
...@@ -21,8 +21,8 @@ def generate_slurm_script(script_file_path, xp_var_name, task_ids=None, ...@@ -21,8 +21,8 @@ def generate_slurm_script(script_file_path, xp_var_name, task_ids=None,
The resulting script is written in the experiment folder, and the command The resulting script is written in the experiment folder, and the command
to launch the jobs with Slurm is displayed in the terminal. to launch the jobs with Slurm is displayed in the terminal.
An example script illustrating how to use An example of a similar usage in the case of OAR (script
:func:`yafe.utils.generate_slurm_script` is available in the corresponding :func:`yafe.utils.generate_oar_script`) is illustrated by in
:ref:`tutorial <tutorial_oar>`. :ref:`tutorial <tutorial_oar>`.
Parameters Parameters
...@@ -49,9 +49,8 @@ def generate_slurm_script(script_file_path, xp_var_name, task_ids=None, ...@@ -49,9 +49,8 @@ def generate_slurm_script(script_file_path, xp_var_name, task_ids=None,
activated. activated.
use_gpu : bool use_gpu : bool
Flag specifying if a gpu ressource is needed when running the Flag specifying if a gpu ressource is needed when running the
experiment. experiment. This has not been implemented yet.
""" """
# TODO update documentation
script_file_path = Path(script_file_path) script_file_path = Path(script_file_path)
script_dir = script_file_path.parent script_dir = script_file_path.parent
script_name = script_file_path.stem script_name = script_file_path.stem
...@@ -63,26 +62,11 @@ def generate_slurm_script(script_file_path, xp_var_name, task_ids=None, ...@@ -63,26 +62,11 @@ def generate_slurm_script(script_file_path, xp_var_name, task_ids=None,
script_dir.mkdir(exist_ok=True) script_dir.mkdir(exist_ok=True)
for f in script_dir.glob('*.sh'): for f in script_dir.glob('*.sh'):
os.remove(f) os.remove(f)
# script_dir.rm
if task_ids is None: if task_ids is None:
task_ids = xp.get_pending_task_ids() task_ids = xp.get_pending_task_ids()
# split and save the tasks
# task_ids = list(map(str, task_ids))
# batches = [
# task_ids[i:(i + batch_size)]
# for i in range(0, len(task_ids), batch_size)
# ]
# file_path = xp.xp_path / 'listoftasks.txt'
#
# with open(str(file_path), 'wt') as fout:
# fout.write('\n'.join(map(lambda batch: ','.join(batch), batches)))
# generate and save script # generate and save script
# script_path = Path(os.path.abspath(script_file_path))
# script_dir = script_path.parent
# script_name = script_path.stem
# Generate job script # Generate job script
log_dir = xp.xp_path / 'logs' log_dir = xp.xp_path / 'logs'
...@@ -101,9 +85,6 @@ def generate_slurm_script(script_file_path, xp_var_name, task_ids=None, ...@@ -101,9 +85,6 @@ def generate_slurm_script(script_file_path, xp_var_name, task_ids=None,
# script += '#SBATCH -p gpu IS NULL\n' # script += '#SBATCH -p gpu IS NULL\n'
script += 'srun -N1 -n1 {}/run_$SLURM_ARRAY_TASK_ID.sh'.format(script_dir) script += 'srun -N1 -n1 {}/run_$SLURM_ARRAY_TASK_ID.sh'.format(script_dir)
# script += 'echo "OAR_JOB_ID: $OAR_JOB_ID"\n'
# script += 'echo "OAR_ARRAY_ID: $OAR_ARRAY_ID"\n'
# script += 'echo "SLURM_ARRAY_TASK_ID: $SLURM_ARRAY_TASK_ID"\n'
script_path = script_dir / 'script_slurm.sh' script_path = script_dir / 'script_slurm.sh'
with script_path.open('w') as file: with script_path.open('w') as file:
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
# #
# ######### COPYRIGHT ######### # ######### COPYRIGHT #########
""" """
Run this script to handle the main experiment :class:`SolveTffExperiment`. Run this script to handle the main experiment :class:`VarianceTffExperiment`.
.. moduleauthor:: Valentin Emiya .. moduleauthor:: Valentin Emiya
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment