Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
import sys
import re
import os
from collections import defaultdict
PARTNER_PENALTY = 2
OPPONENT_PENALTY = 1
1A2B
3C4D
5E6F
7G8H
9I10J
11K12L
1K12J
2L3A
4B5C
#!/usr/bin/python
import sys
import re
import os
from collections import defaultdict
PARTNER_PENALTY = 2
OPPONENT_PENALTY = 1
@AdamStelmaszczyk
AdamStelmaszczyk / run.py
Created May 12, 2020 18:38
Python Speed Coding Challenge source code
# The MIT License
#
# Copyright (c) 2020 Adam Stelmaszczyk
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@AdamStelmaszczyk
AdamStelmaszczyk / enca
Last active February 14, 2018 19:28
To have Polish characters in subtitles
Usually the encoding is "MS-Windows code page 1250", but we want UTF-8.
sudo apt-get install enca
enconv -L polish -x utf8 subtitles.srt
To check file encoding use -m:
enconv -L polish -m subtitles.srt
$ python run_job.py -n 5 -g 60 -c 12 --simulator_procs 10 --use_sync --name breakout --short
args.offline: False
('bash command: ', 'srun -A luna -N 5 -n 5 -c 12 -t 55:00 distributed_tensorpack_mkl.sh 61216 30065 Breakout-v0 adam 1 "3nodes 12cores" "breakout_1517329773.87" 0.00015 128 60 0 None 256 10 1 uniform normal False . True 1 False /net/archive/groups/plggluna/intel_2/logs/ 1e-08 0.9 0.999 0 False False False False 120 False')
srun: job 9511741 queued and waiting for resources
srun: job 9511741 has been allocated resources
SLURM_JOB_ID 9511741 ; SLURM_JOB_NAME distributed_tensorpack_mkl.sh ; SLURM_JOB_NODELIST p[0111-0112,0115,0574,0576] ; SLURMD_NODENAME p0112 ; SLURM_JOB_NUM_NODES 5
SLURM_JOB_ID 9511741 ; SLURM_JOB_NAME distributed_tensorpack_mkl.sh ; SLURM_JOB_NODELIST p[0111-0112,0115,0574,0576] ; SLURMD_NODENAME p0111 ; SLURM_JOB_NUM_NODES 5
SLURM_JOB_ID 9511741 ; SLURM_JOB_NAME distributed_tensorpack_mkl.sh ; SLURM_JOB_NODELIST p[0111-0112,0115,0574,0576] ; SLURMD_NODENAME p0115 ;
$ python run_job.py -n 5 -g 60 -c 12 --use_sync --name neptune_job_name clear^C
[prometheus][plghenrykm@login01 src]$ vim OpenAIGym/train.py
[prometheus][plghenrykm@login01 src]$ python run_job.py -n 5 -g 60 -c 12 --use_sync --name neptune_job_name
args.offline: False
('bash command: ', 'srun -A luna -N 5 -n 5 -c 12 -t 6:00:00 distributed_tensorpack_mkl.sh 17351 9236 Breakout-v0 adam 1 "3nodes 12cores" "neptune_job_name_1517240471.8" 0.00015 128 60 0 None 256 100 1 uniform normal False . True 1 False /net/archive/groups/plggluna/intel_2/logs/ 1e-08 0.9 0.999 0 False False False False 120 False')
SLURM_JOB_ID 9495449 ; SLURM_JOB_NAME distributed_tensorpack_mkl.sh ; SLURM_JOB_NODELIST p[1567-1568,1577,1580,1584] ; SLURMD_NODENAME p1584 ; SLURM_JOB_NUM_NODES 5
SLURM_JOB_ID 9495449 ; SLURM_JOB_NAME distributed_tensorpack_mkl.sh ; SLURM_JOB_NODELIST p[1567-1568,1577,1580,1584] ; SLURMD_NODENAME p1580 ; SLURM_JOB_NUM_NODES 5
mkdir: cannot create directory ‘/net/archive/groups/plggluna
$ python run_job.py -n 5 -g 60 -c 12 --use_sync --name neptune_job_name
args.offline: False
('bash command: ', 'srun -A luna -N 5 -n 5 -c 12 -t 6:00:00 distributed_tensorpack_mkl.sh 35083 45394 Breakout-v0 adam 1 "3nodes 12cores" "neptune_job_name_1517179219.79" 0.00015 128 60 0 None 256 100 1 uniform normal False . True 1 False /net/archive/groups/plggluna/intel_2/logs/ 1e-08 0.9 0.999 0 False False False False 120 False')
SLURM_JOB_ID 9486553 ; SLURM_JOB_NAME distributed_tensorpack_mkl.sh ; SLURM_JOB_NODELIST p[1340-1341,1343,1347-1348] ; SLURMD_NODENAME p1341 ; SLURM_JOB_NUM_NODES 5
SLURM_JOB_ID 9486553 ; SLURM_JOB_NAME distributed_tensorpack_mkl.sh ; SLURM_JOB_NODELIST p[1340-1341,1343,1347-1348] ; SLURMD_NODENAME p1343 ; SLURM_JOB_NUM_NODES 5
SLURM_JOB_ID 9486553 ; SLURM_JOB_NAME distributed_tensorpack_mkl.sh ; SLURM_JOB_NODELIST p[1340-1341,1343,1347-1348] ; SLURMD_NODENAME p1347 ; SLURM_JOB_NUM_NODES 5
SLURM_JOB_ID 9486553 ; SLURM_JOB_NAME distributed_tensorpack_mkl.sh ; SLURM_JOB_NOD
@AdamStelmaszczyk
AdamStelmaszczyk / py2
Last active August 22, 2017 18:45
valgrind --leak-check=full python memleak.py
==47003== HEAP SUMMARY:
==47003== in use at exit: 10,310,600 bytes in 10,626 blocks
==47003== total heap usage: 34,382,917 allocs, 34,372,291 frees, 6,408,626,531 bytes allocated
==47003==
==47003== 48 bytes in 1 blocks are definitely lost in loss record 1,256 of 1,984
==47003== at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==47003== by 0x6EA8FBD: SwigPyClientData_New (in /home/astelma/miniconda3/envs/py2/lib/python2.7/site-packages/opensim/_simbody.so)
==47003== by 0x6EB4B73: SwigPyIterator_swigregister (in /home/astelma/miniconda3/envs/py2/lib/python2.7/site-packages/opensim/_simbody.so)
==47003== by 0x4F351E4: call_function (ceval.c:4352)
==47003== by 0x4F351E4: PyEval_EvalFrameEx (ceval.c:2989)
# Copyright 2017 reinforce.io. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,