以前のMBPではNVIDIAのGPUが搭載されていました。
そのうちの一つがMBP Retina Mid 2012です。この機種にはNVIDIAのGeForce GT 650M
が搭載されており、CUDA Capability
は3.0
と今となっては古いながらもCUDAが動作するようでした。
昨今GPUといえばGPGPU、とにもかくにも機械学習ということでPyTorchをGPUで動かせるか?ということを調べました。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: from sqlalchemy import create_engine | |
In [2]: postgresql_engine = create_engine('postgresql://') | |
In [3]: mysql_engine = create_engine('mysql://') | |
In [4]: from myapp.resources import Event | |
In [5]: from sqlalchemy.schema import CreateTable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title": "AquaSKK", | |
"rules": [ | |
{ | |
"description": "Ctrl-J to Kana on Apple Terminal/iTerm2", | |
"manipulators": [ | |
{ | |
"type": "basic", | |
"from": { | |
"key_code": "j", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! Workon(name) | |
" Get virtualenv's site-packages directory. | |
let b:virtualenv_sitepackages_dir = system('workon ' . a:name . '; cdsitepackages; echo -n $PWD') | |
python << EOM | |
import vim | |
import sys | |
virtualenv_sitepackages_dir = vim.eval('b:virtualenv_sitepackages_dir') | |
if virtualenv_sitepackages_dir not in sys.path: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% python passing_queue_like_go.py | |
Traceback (most recent call last): | |
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/queues.py", line 266 | |
, in _feed | |
send(obj) | |
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/queues.py", line 77, | |
in __getstate__ | |
assert_spawning(self) | |
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/forking.py", line 52 | |
, in assert_spawning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import os | |
import sys | |
import pygit2 | |
import coverage | |
def collect_addition(hunk): | |
result = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import subprocess | |
def kill_children_process(pid, force=False): | |
pid = int(pid) | |
for line in subprocess.check_output( | |
'/bin/ps -eo "ppid pid"', | |
shell=True).split('\n')[1:]: | |
line = line.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh # -x | |
function usage { | |
echo "Usage: $0 python_path virtualenv_path" | |
echo "Setup a virtalenv for Google Appengine." | |
echo "" | |
echo "python_path Path to the Python interpreter used to the virtualenv." | |
echo "virtualenv_path Path to the target virtualenv." | |
exit | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nnoremap <expr> / ':<C-u>Unite -start-insert -buffer-name="search-' . buffer_number('%') . '" line<CR>' | |
nnoremap <expr> * ':<C-u>UniteWithCursorWord -buffer-name="search-' . buffer_number('%') . '" line<CR>' | |
nnoremap <expr> n ':<C-u>UniteResume -no-start-insert -buffer-name="search-' . buffer_number('%') . '"<CR>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
from datetime import date | |
class YearMonth(object): | |
""" List year/month from specified to today """ | |
def __init__(self, year, month, format='%Y/%m'): | |
self.year = year | |
self.month = month | |
self.format = format |
NewerOlder