Ejemplo n.º 1
0
def _test_gpu():
    from poker.game.deal import deal

    with monit.section("Allocate"):
        cards = torch.zeros((1_000_000, 7),
                            dtype=torch.long,
                            device=torch.device('cuda'))
    with monit.section('Deal'):
        deal(cards, 0)
    scorer = Combinations(cards)
    with monit.section("Score"):
        scores_vec = scorer()
Ejemplo n.º 2
0
def _test():
    from poker.game.deal import deal

    cards = torch.zeros((20_000, 7), dtype=torch.long)
    deal(cards, 0)
    cards[0] = torch.tensor([13, 14, 15, 16, 20, 25, 38])
    scorer = Sequences(cards)
    with monit.section("Dumb"):
        scores = scorer(is_dumb=True)
    with monit.section("Vector"):
        scores_vec = scorer()

    print((scores != scores_vec).sum())
Ejemplo n.º 3
0
def _test():
    from poker.game.deal import deal

    cards = torch.zeros((100000, 7), dtype=torch.long)
    deal(cards, 0)
    # cards[0] = torch.tensor([ 2,  4,  6, 15, 19, 24, 50])
    scorer = Combinations(cards)
    with monit.section("Dumb"):
        scores = scorer(is_dumb=True)
    with monit.section("Vector"):
        scores_vec = scorer()

    print((scores != scores_vec).sum())
Ejemplo n.º 4
0
    def __start_from_checkpoint(self, run_uuid: str, checkpoint: Optional[int]):
        checkpoint_path, global_step = experiment_run.get_last_run_checkpoint(
            self.experiment_path,
            run_uuid,
            checkpoint)

        if global_step is None:
            return 0
        else:
            with monit.section("Loading checkpoint"):
                self._load_checkpoint(checkpoint_path)
            self.run.load_run = run_uuid

        return global_step
Ejemplo n.º 5
0
 def section(self, name: str):
     return monit.section(name, is_silent=not self.is_debug)