Archive for January, 2013

In the .htaccess file

AddHandler fcgid-script .py

Here is the .py code that will work.


wsgi_variables = ( ‘REQUEST_METHOD’,

import sys, os

sys.path.insert( 0, ‘/home5/cvxcloud/local/lib/python2.6/site-packages’)
sys.path.insert( 0, ‘/usr/lib/python2.6/site-packages’)
sys.path.insert( 0, ‘/home5/cvxcloud/local/lib64/python2.6/site-packages’)
sys.path.insert( 0, ‘/home5/cvxcloud/.local/lib/python2.6/site-packages’)

os.environ[‘LD_LIBRARY_PATH’] = ‘/home5/cvxcloud/local/lib:/home5/cvxcloud/.loc\
_PROJECT_DIR = ‘/home5/cvxcloud/django/jan2013’

_PROJECT_NAME = ‘jan2013’
os.environ[‘DJANGO_SETTINGS_MODULE’] = “%s.settings” % _PROJECT_NAME
# placeholder
def hello(environ, start_response):
start_response( ‘200 OK’, [(‘Content-type’, ‘text/plain’)] )
r = “<html><body>Hello from py</body></html>”

if __name__ == ‘__main__’:

environ = dict(os.environ.items())

environ[‘wsgi.version’] = (1,0)
environ[‘wsgi.url_scheme’] = ‘http’
environ[‘wsgi.multithread’] = False
environ[‘wsgi.multiprocess’] = True
environ[‘wsgi.run_once’] = True
environ[‘wsgi.input’] = sys.stdin
environ[‘wsgi.errors’] = sys.stderr

from django.core.wsgi import get_wsgi_application
from flup.server.fcgi_fork import WSGIServer

WSGIServer( hello ).run()


Read Full Post »

This afternoon I started writing a parser for AMPL from example files oil.mod and oil.dat.  Funky features of the specifications include wildcard shorthands like

(X,*) := A B C

which evaluates to (X,A) (X,B) (X,C) and so on for sets.  In any case, there are layers of evaluations before numerical figures for parameters in the actual objective function and constraints can be reached and this evaluation is needed to construct the A and G matrices for cvxopt.

Now I am thinking of looking over my efforts to learn and then implement the parsers using flex and bison for which I found an excellent seeming tutorial.

Read Full Post »

So I have been preparing the Red Hat 4.4.6-4 Operon 1900 MHz machine that runs http://www.cvxcloudopt.com.  Numpy and Scipy python libraries work with linear algebra packages ATLAS or BLAS+LAPACK.  The compilation is not trivial because basic compiler flags like -m64 and -fPIC are not set in the default.  I was going to write steps to these installs but found that Marco Budisic had already done so.

Incidentally, a performance benchmark had shown that numpy performs comparably to C++/BLAS and python/BLAS.

I will proceed after this step to installing cvxopt, scipy, numpy and then prepare to transfer the django application to the server to begin recoding the cloud process management with a web front end.

Read Full Post »