initialize¶
Variable initialization for Neuroevolution fitting.
- cneuromax.fitting.neuroevolution.utils.initialize.initialize_common_variables(agents_per_task, num_pops)[source]¶
Initializes variables common to all execution modes.
- Parameters:
agents_per_task (
int) – Seeagents_per_task.
- Return type:
tuple[int,int,ndarray[Shape[Pop_size, Num_pops, [mpi_buffer_size, agent_pair_position, sending, seeds]],dtype[uint32]] |None,ndarray[Shape[Len_agents_batch, Num_pops, [mpi_buffer_size, agent_pair_position, sending, seeds]],dtype[uint32]],ndarray[Shape[Len_agents_batch, Num_pops],dtype[uint32]],ndarray[Shape[Pop_size, Num_pops, [fitness, num_env_steps, serialized_agent_size]],dtype[float32]] |None,ndarray[Shape[Len_agents_batch, Num_pops, [fitness, num_env_steps, serialized_agent_size]],dtype[float32]],Optional[int]]- Returns:
pop_size,len_agents_batch,exchange_and_mutate_info,exchange_and_mutate_info_batch, An array used as a buffer by all processes to receive the seeds from the primary process during the first generation only.generation_results,generation_results_batch,total_num_env_steps.
- cneuromax.fitting.neuroevolution.utils.initialize.initialize_gpu_comm()[source]¶
Initializes a communicator for GPU work queueing.
Assuming the experiment is ran with
NMPI processes &MGPUs, this function will createMcommunicators, each containingN/Mprocesses. Each communicator will be used to gather mutated agents onto one process, which will then evaluate them on the GPU.- Return type:
- Returns:
See
ith_gpu_comm.
- cneuromax.fitting.neuroevolution.utils.initialize.initialize_agents(agent, len_agents_batch, num_pops, *, pop_merge)[source]¶
Initializes a batch of agents.
- Parameters:
len_agents_batch (
int) – The number of agents per population maintained inagents_batchby the process calling this function during a given generation.
- Return type:
- Returns:
A 2D list of agents maintained by this process.