Exemplo n.º 1
0
 def __init__(self, problem, shared, verbose=False, memory_limit=0):
     """
     Constructor.
     """
     multiprocessing.Process.__init__(self)
     self.problem = problem
     self.shared = shared
     self.verbose = verbose
     self.memory_limit = memory_limit
     if memory_limit > 0:
         from memorymonitor import MemoryMonitor
         self.memmon = MemoryMonitor()
Exemplo n.º 2
0
#!/usr/bin/env python
#http://www-rohan.sdsu.edu/~gawron/mt_plus/mt/course_core/lectures/assignment_five.pdf
#http://www.cs.jhu.edu/~alopez/papers/model1-note.pdf
#http://www.inf.ed.ac.uk/teaching/courses/mt/assignments/assignment2.pdf
#http://www.mt-archive.info/MTMarathon-2010-Lambert-ppt.pdf
import optparse
import sys
from collections import defaultdict
from memorymonitor import MemoryMonitor

memory_mon = MemoryMonitor('madmaze')
startMemory = memory_mon.usage()

def trainfw(itr):
	x=0
	print "Memory increased by", int(memory_mon.usage()) - startMemory
	
	for (n, (f, e)) in enumerate(bitext):
		if n%1000==0:
			print "loading...",n
		for f_i in set(f):
			f_total[f_i] = 0.0

			for e_j in set(e):
				ef_count[(e_j,f_i)] = 0.0
				t_ef[(e_j,f_i)]=1.0

		
	x=0
	print "Memory increased by", int(memory_mon.usage()) - startMemory
	
Exemplo n.º 3
0
### script to generate time series data from Will's computer ###
import os, timeit, sys, getpass
from time import sleep, time
from datetime import datetime
sys.path.append(os.getcwd() + '/include/')
from memorymonitor import MemoryMonitor
import commands

small_ratio = 48
## how many hours of recording

# ----- Initialize -----
path = os.getcwd() + '/../../track/'
file = 'track_' + datetime.now().isoformat() + '.txt'
#   --- Memory monitor ---
mem_mon = MemoryMonitor(getpass.getuser())
T = 0

# ----- Name & create files -----
tl = ['cpu_', 'mem_']
tfile = []
for t in tl:
    temp = path + t + file
    os.system('touch ' + temp)
    tf = open(temp, 'a')
    tfile.append(tf)
    tf.write(datetime.now().isoformat() + '\n')
    tf.write(' record time: ' + str(small_ratio) + ' hours')

# ----- Start tracking -----
while (T < small_ratio * 3600):