> brew install poppler でいれる。
> pdftoppm -png inputfile output_prefixouput_prefix_01, output_prefix_02 のようなファイルができる。
技術系の備忘録.基本的に自分だけのためのものなので,詳しく書きません.検索でいらした方、すみません.
pyenv で普通に導入したpython 3.10だとlzmaが足りないということでエラーがでる。 ので、anacondaを導入してそちらを使ったらあっさり動いた。すばらしい。
MPSを使うとこんなかんじ。
Epoch 1 / 5: time = 95.05[s], loss = 170.33 Epoch 2 / 5: time = 183.52[s], loss = 138.28 Epoch 3 / 5: time = 270.67[s], loss = 124.85 Epoch 4 / 5: time = 356.84[s], loss = 114.28 Epoch 5 / 5: time = 458.32[s], loss = 106.25 Train time on mps: 458.32[s] (Train loss = 106.25) Test time on mps: 52.92[s](Test loss = 21.62)CPUだとこんなかんじ。
Epoch 1 / 5: time = 446.72[s], loss = 169.79 Epoch 2 / 5: time = 899.81[s], loss = 136.01 Epoch 3 / 5: time = 1379.53[s], loss = 122.38 Epoch 4 / 5: time = 1818.74[s], loss = 112.07 Epoch 5 / 5: time = 2305.36[s], loss = 105.47 Train time on cpu: 2305.36[s] (Train loss = 105.47) Test time on cpu: 102.65[s](Test loss = 20.72)元記事とCPU性能は変わらないけどMPS性能は半分ぐらい、というかんじか。 元記事はMacbook ProでM1 MAX、こちらは Air なのでこんなものだろう。 CPUとMPSの差はざっくり5倍という程度。テストには使えそうなのでうれしい。
しかし、負荷かけるとコア温度が76度ぐらいまでいくな。M1 Airではみたこともないような値。 ファンついてないんだけど大丈夫なんだろうか。
(defun insert_revert (key) (setq v (lookup-key (current-global-map) key)) (global-set-key key (lambda () (interactive) (mac-select-input-source "com.apple.keylayout.ABC") (funcall v)))) (insert_revert "\C-s") (insert_revert "\C-r")
local function keyCode(key, modifiers)
modifiers = modifiers or {}
return function()
hs.eventtap.event.newKeyEvent(modifiers, string.lower(key), true):post()
hs.timer.usleep(1000)
hs.eventtap.event.newKeyEvent(modifiers, string.lower(key), false):post()
end
end
local function remapKey(modifiers, key, keyCode)
hs.hotkey.bind(modifiers, key, keyCode, nil, keyCode)
end
remapKey({'ctrl'}, 'b', keyCode('left'))
remapKey({'ctrl'}, 'n', keyCode('down'))
remapKey({'ctrl'}, 'p', keyCode('up'))
remapKey({'ctrl'}, 'f', keyCode('right'))
remapKey({'ctrl'}, 'e', keyCode('end'))
remapKey({'ctrl'}, 'a', keyCode('home'))
remapKey({'ctrl'}, 'h', keyCode('delete'))
#!/usr/bin/python
import os
import sys
import httplib2
import pprint
from apiclient.discovery import build
from apiclient.http import MediaFileUpload
from oauth2client.client import OAuth2WebServerFlow
from apiclient import errors
def download_file(service, drive_file):
"""Download a file's content.
Args:
service: Drive API service instance.
drive_file: Drive File instance.
Returns:
File's content if successful, None otherwise.
"""
# download_url = drive_file['exportLinks']['text/csv']
download_url = 'https://docs.google.com/feeds/download/spreadsheets/Export?key=' + drive_file['id'] + '&exportFormat=csv'
if download_url:
resp, content = service._http.request(download_url)
if resp.status == 200:
# print 'Status: %s' % resp
return content
else:
print 'An error occurred: %s' % resp
return None
else:
# The file doesn't have any content stored on Drive.
return None
# Copy your credentials from the console
CLIENT_ID = 'XXXX'
CLIENT_SECRET = 'XXXXXXX'
#FILE_ID
FILE_ID = 'XXXXXXXX'
# Check https://developers.google.com/drive/scopes for all available scopes
OAUTH_SCOPE = 'https://www.googleapis.com/auth/drive'
# Redirect URI for installed apps
REDIRECT_URI = 'urn:ietf:wg:oauth:2.0:oob'
# Path to the file to upload
FILENAME = 'document.txt'
# Run through the OAuth flow and retrieve credentials
flow = OAuth2WebServerFlow(CLIENT_ID, CLIENT_SECRET, OAUTH_SCOPE,
redirect_uri=REDIRECT_URI)
authorize_url = flow.step1_get_authorize_url()
print 'Go to the following link in your browser: ' + authorize_url
os.system("open '" + authorize_url + "'")
code = raw_input('Enter verification code: ').strip()
credentials = flow.step2_exchange(code)
# Create an httplib2.Http object and authorize it with our credentials
http = httplib2.Http()
http = credentials.authorize(http)
drive_service = build('drive', 'v2', http=http)
drive_file = drive_service.files().get(fileId=FILE_ID).execute()
c = download_file(drive_service, drive_file)
f = open(sys.argv[1], 'w')
f.write(c)
f.close()
> ./deviceQuery [~/projects/cuda/NVIDIA_CUDA-6.5_Samples/bin/x86_64/darwin/release]
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce GT 650M"
CUDA Driver Version / Runtime Version 6.5 / 6.5
CUDA Capability Major/Minor version number: 3.0
Total amount of global memory: 1024 MBytes (1073414144 bytes)
( 2) Multiprocessors, (192) CUDA Cores/MP: 384 CUDA Cores
GPU Clock rate: 900 MHz (0.90 GHz)
Memory Clock rate: 2508 Mhz
Memory Bus Width: 128-bit
L2 Cache Size: 262144 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096)
Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 65536
Warp size: 32
Maximum number of threads per multiprocessor: 2048
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 1 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
Device supports Unified Addressing (UVA): Yes
Device PCI Bus ID / PCI location ID: 1 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 6.5, CUDA Runtime Version = 6.5, NumDevs = 1, Device0 = GeForce GT 650M
Result = PASS
sudo pmset -a hibernatemode 1
sudo pmset -a hibernatemode 3
(cond (window-system
(setq x-select-enable-clipboard t)
(setq yank-excluded-properties t)
))
JAVA_OPTS="-Dfile.encoding=UTF-8"コンパイル時には不要らしい。しかし、なんでこんなもんがいるんだ?javaだとふつうにできるのにね。