wandb_init Subroutine

public subroutine wandb_init(project, name, entity, sweep_id)

Initialise a wandb run.

             the run joins the sweep and its wandb.config is
             populated with the sweep-sampled hyperparameters.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: project

Project name (required).

character(len=*), intent(in), optional :: name

Run display name (optional).

character(len=*), intent(in), optional :: entity

wandb entity / team (optional).

character(len=*), intent(in), optional :: sweep_id

Sweep ID returned by wandb_sweep. When supplied,


Source Code

  subroutine wandb_init(project, name, entity, sweep_id)
    !! Initialise a wandb run.
    !!
    !! @param project   Project name (required).
    !! @param name      Run display name (optional).
    !! @param entity    wandb entity / team (optional).
    !! @param sweep_id  Sweep ID returned by wandb_sweep.  When supplied,
    !!                  the run joins the sweep and its wandb.config is
    !!                  populated with the sweep-sampled hyperparameters.
    character(len=*), intent(in)           :: project
    character(len=*), intent(in), optional :: name
    character(len=*), intent(in), optional :: entity
    character(len=*), intent(in), optional :: sweep_id

    integer(c_int) :: rc
    character(len=:), allocatable :: c_name, c_entity, c_sweep_id

    if(present(name))then
       c_name = name // c_null_char
    else
       c_name = c_null_char
    end if

    if(present(entity))then
       c_entity = entity // c_null_char
    else
       c_entity = c_null_char
    end if

    if(present(sweep_id))then
       c_sweep_id = trim(sweep_id) // c_null_char
    else
       c_sweep_id = c_null_char
    end if

    rc = wandb_init_c( &
         project // c_null_char, &
         c_name,    &
         c_entity,  &
         c_sweep_id &
    )

    if(rc /= 0)then
       write(0,*) "[wf] WARNING: wandb_init failed (rc=", rc, ")"
       write(0,*) "  Logging will be silently skipped."
    end if

  end subroutine wandb_init