Skip to content

Commit

Permalink
Merge pull request #2892 from h-mayorquin/verbose_to_non_parallel_case
Browse files Browse the repository at this point in the history
Enable verbose  of `ChunkRecordingExecutor`  also for non parallel case
  • Loading branch information
samuelgarcia authored May 24, 2024
2 parents b25460f + eb03db8 commit 73c8f07
Showing 1 changed file with 16 additions and 23 deletions.
39 changes: 16 additions & 23 deletions src/spikeinterface/core/job_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
"""

from __future__ import annotations
from pathlib import Path
import numpy as np
import platform
import os
import warnings
from spikeinterface.core.core_tools import convert_string_to_bytes
from spikeinterface.core.core_tools import convert_string_to_bytes, convert_bytes_to_str, convert_seconds_to_str

import sys
from tqdm.auto import tqdm
Expand Down Expand Up @@ -369,27 +368,21 @@ def __init__(
self.max_threads_per_process = max_threads_per_process

if verbose:
if self.n_jobs > 1:
chunk_memory = self.chunk_size * recording.get_num_channels() * np.dtype(recording.get_dtype()).itemsize
total_memory = chunk_memory * self.n_jobs
chunk_duration = self.chunk_size / recording.get_sampling_frequency()
from spikeinterface.core.core_tools import convert_bytes_to_str, convert_seconds_to_str

chunk_memory_str = convert_bytes_to_str(chunk_memory)
total_memory_str = convert_bytes_to_str(total_memory)
chunk_duration_str = convert_seconds_to_str(chunk_duration)
print(
self.job_name,
"\n"
f"n_jobs={self.n_jobs} - "
f"samples_per_chunk={self.chunk_size:,} - "
f"chunk_memory={chunk_memory_str} - "
f"total_memory={total_memory_str} - "
f"chunk_duration={chunk_duration_str}",
)

else:
print(self.job_name, "with n_jobs =", self.n_jobs, "and chunk_size =", self.chunk_size)
chunk_memory = self.chunk_size * recording.get_num_channels() * np.dtype(recording.get_dtype()).itemsize
total_memory = chunk_memory * self.n_jobs
chunk_duration = self.chunk_size / recording.get_sampling_frequency()
chunk_memory_str = convert_bytes_to_str(chunk_memory)
total_memory_str = convert_bytes_to_str(total_memory)
chunk_duration_str = convert_seconds_to_str(chunk_duration)
print(
self.job_name,
"\n"
f"n_jobs={self.n_jobs} - "
f"samples_per_chunk={self.chunk_size:,} - "
f"chunk_memory={chunk_memory_str} - "
f"total_memory={total_memory_str} - "
f"chunk_duration={chunk_duration_str}",
)

def run(self):
"""
Expand Down

0 comments on commit 73c8f07

Please sign in to comment.