Skip to content

Instantly share code, notes, and snippets.

MacBook Pro Retina Mid 2012にPyTorchをGPU付きでセットアップするまで

これは

以前のMBPではNVIDIAのGPUが搭載されていました。 そのうちの一つがMBP Retina Mid 2012です。この機種にはNVIDIAのGeForce GT 650Mが搭載されており、CUDA Capability3.0と今となっては古いながらもCUDAが動作するようでした。 昨今GPUといえばGPGPU、とにもかくにも機械学習ということでPyTorchをGPUで動かせるか?ということを調べました。

結果

@jbking
jbking / aquaskk.json
Last active July 24, 2018 06:29
my configuration of Karabiner-Elements for AquaSKK(refs: https://pqrs.org/osx/karabiner/json.html)
{
"title": "AquaSKK",
"rules": [
{
"description": "Ctrl-J to Kana on Apple Terminal/iTerm2",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "j",
@jbking
jbking / nginx.conf
Created May 10, 2015 11:39
proxy to same location but via different path with logging each other.
error_log logs/error.log error;
http {
access_log logs/access.log combined;
server {
listen 8081;
root /tmp/;
}
server {
listen 8080;
@jbking
jbking / inheritance.py
Last active August 29, 2015 14:10
Check Python Inheritance Behavior
$ python inheritance.py
At SuperClass.echo: SuperClass
----------
Before calling super at AClass.echo: AClass
At SuperClass.echo: AClass
After calling super at AClass.echo: AClass
----------
Before calling super at BClass.echo: BClass
At SuperClass.echo: BClass
After calling super at BClass.echo: BClass
import shutil
import os
import sys
import pickle
from dropbox.rest import ErrorResponse
STATE_FILE = '.dropbox_state'
REMOTE_ROOT_PATH = '/Apps/my-pythonista-app' # sync root in dropbox where code is
@jbking
jbking / Counter.py
Last active August 29, 2015 14:04
Counter
# coding: utf-8
import ui
v = ui.load_view('Untitled')
i = 0
lbl = v['label1']
def btn_action(sender):
global i
@jbking
jbking / passing_queue_like_go.py
Last active January 4, 2016 04:39
The object for IPC couldn't be passed to another process which is able to pass to another goroutine in golang. Interchanging such object in golang is not actual IPC, but its design could be similar, for similar usage.
% 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
@jbking
jbking / gist:5010252
Last active May 13, 2023 11:11
How to get engine specific creating table DDL in SQLAlchemy.
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
@jbking
jbking / missing_appear.py
Created November 29, 2012 13:50
find coverage missing appeared in latest commit.
from __future__ import print_function
import os
import sys
import pygit2
import coverage
def collect_addition(hunk):
result = []
@jbking
jbking / kill_children_process.py
Created November 13, 2011 07:32
kill children process recursively.
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()