Author Archive: Ankit

Ukulele

An amazing gift from Sonya. All my memories, all remembrances from the last 7-8 years, distilled on to the beautiful wooden surface of a ukulele.

Picture2

 

Thanks!

Python, pycuda, gpu computing et. al.

I have often thought about why is it that nature is so fast whereas our simulations of it are so annoyingly slow and my mind always goes to the same sort of conclusion, nature is a massively parallel system, a seamless collection of very simple processes all taking place at the same time. It then appears that a computation strategy which mimics this parallelism to a certain extent will serve to gain much in terms of sheer computational power and efficiency. Of course there must be incredible challenges or it would be done by now but there you are. Now GPU (graphical processing unit) computing is something which looks suspiciously relevant in this scenario and I have begun exploring it a little for my own purposes. GPU computing allows one to execute massive number of relatively simple processes all at the same time. The catch is that the problem often has to be recast to make it suitable for treatment within the GPU paradigm but if this can be done, and done well, it may lead to significant improvements in efficiency.

Having said that any researcher worth his salt should begin coding in C or fortran and then exploit NVIDIA's CUDA (Compute Unified Device Architecture) to do computations on the NVIDIA GPUs present in most modern computers. I, however, am not a researcher worth my salt, at least not yet by that definition. I code in MATLAB and have recently moved to Python, driven by my pursuit to rid myself of all software which is not exactly free. Python coupled with Numpy is a formidable competitor to MATLAB and it makes sense to eventually port everything to it, if not C and Fortran. This still leaves the issue of parallelization. Fortunately NVIDIA has begun supporting python through PyCuda and I have spent the better part of the last two days trying to figure out how to make it all work. To use Python+Numpy+PyCUDA I needed to install a few things on my machine (Windows 7). Here is a list:

1. Python 2.7.5 from http://www.python.org/getit/ (I used the x86-64 installer which is suitable for 64 bit Win7). I went to the directory where Python is installed and copied its address to the PATH variable. This allows you to run the Python interpreter from the command line.

2. Numpy. A great list of Python packages is at http://www.lfd.uci.edu/~gohlke/pythonlibs/ with numpy being at http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy. I initially made the mistake of using a comprehensive Python distribution (Anaconda) which contains both Python and Numpy. It, however, did not make the correct registry entries and, therefore, gave me incredible grief when I was trying to install CUDA. I found it simpler just to do everything myself. Additional necessary packages which I installed from this page were Pytools, Setuputils, matplotlib (and its dependencies).

3. PyCuda can also be installed from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pycuda

4. It's nice to have an Integrated Development Environment (IDE) for Python and I have installed Eclipse for this purpose. You can download it at http://www.eclipse.org/ and look at http://www.vogella.com/articles/Python/article.html for an excellent tutorial on how to get it running and making Python codes.

5. Visual Studio. I haven't been able to figure out why this is required yet but apparently it is essential. I installed VS 2012 Professional from http://www.microsoft.com/visualstudio/eng/downloads.

6. Finally it is time to install CUDA. This can be done from https://developer.nvidia.com/cuda-downloads, choosing the appropriate version for your OS.

Once all this is done you just have to write a python code appropriately configured to use CUDA and voila, it won't run! The trouble is that certain connections which let python know which compiler to use to invoke the CUDA parts of the code don't exist yet. To make those connections consult this: http://wiki.tiker.net/PyCuda/Installation/Windows. However, I had to make appropriate changes to the PATH instructions because my VS is 2012 and not 2008. For some reason my VS installation was also not in the same directory as shown in that link. Moreover, it was a bit of a trouble finding nvcc.profile and then editing it given that it is a read only file to begin with. Anyway, I'm all set now!

Non-belief

During the last 7-8 years I've had the pleasure of being friends with some really interesting and intelligent people. I have mentioned time and again how much I have appreciated learning from them and how much of an imprint I see of their influence in what I am today. I scarcely doubt the sharpness of their minds but sometimes I'm just amazed at some of the logical inconsistencies that even the sharpest of them display. I find it incomprehensible how some of these people who have grown up within the confines of critical thought can justify their beliefs in supernatural phenomenon of all sorts. Of course I never bring these things up in personal discussions because I already know all the superficial arguments which will be made, both on their side and from mine. These arguments don't mean much because people hardly ever say what they really feel. Moreover, I'm not out to put anyone down for what they believe in. I'm merely curious as to how it can all fit together in one mind which had been trained to evaluate the world around it based upon evidence.

I know I am sounding suspiciously like a 16 year old atheist who spends his time arguing on the ridiculous atheist forums of reddit but that's not who I mean to appear like. It is an obnoxious religion,  atheism really. In many aspects worse than other forms of religion because of the incredible smugness involved. Most of the people who call themselves atheists are merely following another inviolable prophet in the name of Richard Dawkins and seem to lack the courage and the intelligence to answer the next logical questions which present themselves when you remove a God. Questions about morality, altruism, ethics, and the stability of society never seem to get asked in their circles. I personally don't doubt the non existence of God but I've always found myself getting lost in the subtlety of the arguments whenever I start thinking about these things. It's not that I don't get anywhere but often where I do end up being is always some sort of a compromise zone where it doesn't make sense to be too militant in my views - the golden mean of all our ideas and beliefs. At those moments I wonder about truth and practicality, about reality and happiness, about steadfast loyalty to certain ideas and the simple desire of not being a massive ass to people who are almost always really really nice despite all our philosophical differences. I find this simple courtesy missing in a lot of atheists, therefore, I'd be damned to be taken as one of them.

This still leaves that one question with which I started this post. How can people, and only certain people to whom I have alluded earlier (they know who they are! ), keep it all coherent in their minds? There was a book that I read several years ago which I remember completely changing my life from there on. U G Krishnamurthy's mind is a myth. I did not learn anything concrete from that book except one thing which was not to take authority seriously, not to believe in the given word. Since then I've seen many of my beliefs crumble around me and I've felt relived every time that has happened. In short, I've replaced shoddy and suspect explanations with uncertainties and crumbling bricks and have felt quite okay about it all - perhaps because the earlier structure was all too garish and incoherent and badly patched up together even though it was complete. I quite like the fallen walls now because they're at least mine. Like other things in life like failures and successes, happiness and sorrows, and actions, I feel relieved to take complete responsibility for my confused structure of non-beliefs.

This is water

The highly erudite David Foster Wallace's very touching commencement speech at Kenyon.

Some lines:

Because here's something else that's true. In the day-to-day trenches of adult life, there is no such thing as atheism. There is no such thing as not worshipping. Everybody worships. The only choice we get is what to worship. And an outstanding reason for choosing some sort of god or spiritual-type thing to worship - be it JC or Allah, be it Yahweh or the Wiccan mother-goddess or the Four Noble Truths or some infrangible set of ethical principles - is that pretty much anything else you worship will eat you alive. If you worship money and things - if they are where you tap real meaning in life - then you will never have enough. Never feel you have enough. It's the truth. Worship your own body and beauty and sexual allure and you will always feel ugly, and when time and age start showing, you will die a million deaths before they finally plant you. On one level, we all know this stuff already - it's been codified as myths, proverbs, clichés, bromides, epigrams, parables: the skeleton of every great story. The trick is keeping the truth up front in daily consciousness. Worship power - you will feel weak and afraid, and you will need ever more power over others to keep the fear at bay. Worship your intellect, being seen as smart - you will end up feeling stupid, a fraud, always on the verge of being found out.

The insidious thing about these forms of worship is not that they're evil or sinful; it is that they are unconscious. They are default settings. They're the kind of worship you just gradually slip into, day after day, getting more and more selective about what you see and how you measure value without ever being fully aware that that's what you're doing. And the world will not discourage you from operating on your default settings, because the world of men and money and power hums along quite nicely on the fuel of fear and contempt and frustration and craving and the worship of self. Our own present culture has harnessed these forces in ways that have yielded extraordinary wealth and comfort and personal freedom. The freedom to be lords of our own tiny skull-sized kingdoms, alone at the centre of all creation. This kind of freedom has much to recommend it. But there are all different kinds of freedom, and the kind that is most precious you will not hear much talked about in the great outside world of winning and achieving and displaying. The really important kind of freedom involves attention, and awareness, and discipline, and effort, and being able truly to care about other people and to sacrifice for them, over and over, in myriad petty little unsexy ways, every day. That is real freedom. The alternative is unconsciousness, the default setting, the "rat race" - the constant gnawing sense of having had and lost some infinite thing.

Coffee in Chicago

In my few days that I have been in Chicago I have had generally a good impression of the place save for one aspect: its coffee shops. It's not a defect which would bother a lot of people but it is one which, to me, is the most damning defect of a city. Because to me, the non-existence of good coffee shops is not a coincidence but is linked inextricably with the spirit of the place. While walking around Chicago's beautiful tree lined streets and its many vibrant neighborhoods the only coffee shops that I come across are either chains or ones which appear highly pretentious. Chain coffee shops can be pretty good, an example of which is Peet's on the West coast but the ones that I find here are generic and appear to lack that soul which separates a good coffee place from one which would merely do. While I don't have anything against coffee places which are owned by big conglomerates, I absolutely cannot stand places which are pretentious. This general dislike for most things smug has seen me move towards the center and a little right on all issues in life. I have found myself liking things and ideas which have no coolness attached to them, which try to make no statement beyond their own utility, and which have completely missed the fashionable bus. From the vantage point which occupy these ideas I look in at the nuts which occupy the fringes on either side and feel grateful for the fact that I'm not adding to the general noise by being too passionate about things which I don't possess the intelligence to place in their proper contexts.

Anyway, that's a digression for another day. A pretentious coffee place can be easily spotted by its exorbitant prices and a disconcerting presence of too many Apple products. French sounding pastries is another dead giveaway as is the presence of coffee making apparatus which is better suited to a chemistry laboratory. Additionally if a place is named Intelligentsia you don't have to enter it to figure out the level of pretentiousness involved. That's the kind of thing that I am finding here. San Diego, on the other hand, had tons of great middle of the road coffee places with their own distinctive character serving solid coffee in great laid back ambiances. Perhaps it was the nature of the city which was reflected in its cafes. It is a city which has no beefs with anyone and which cannot be bothered by anything because life at the beach and below the ever-shining Sun is just too good. Other places have to do great things and 'succeed' and make statements and appear different and grind their axes. San Diego cannot be bothered by any of these high octane ideas. It's not going anywhere and it doesn't want to go anywhere. It just lounges about with the salty wind in its hair wondering why others have gotten so worked up. It has cafes which exude a similar modest sort of vibe, slowing you down, asking you to stay for a little longer for there is nowhere you must rush to.

Gmsh and Getdp

I have found myself hating to pay for software, especially scientific ones. I am, therefore, always trying to figure out if things can be done with stuff available for free. As far as software available to do scientific word processing is concerned, the paid stuff doesn't even come close to what is available for free. For instance, LaTeX leaves MS-Word in the dust. There is a price to be paid when it comes to the learning curve but LaTeX is an incredibly strong tool which just reeks hardcore utility. I have been trying to find something similar for solving engineering problems. There are a lot of options out there but they often require you to given an arm and a leg for them. For instance, software like COMSOL, ANSYS, ABAQUS etc. are very good I believe but they are quite expensive and, more importantly for me at least, they cloud the underlying mechanism of problem-solving. Nothing too grave for people who just want to use them but for me they leave something to be desired. I recently came across this software which, however, promises other things. The learning curve is steep because there is scant documentation but it looks good in what it can do. So how does it (getdp) work?

All problems in mechanics are basically statements of differential quantities with certain initial conditions and certain boundary conditions. For instance says force equals mass times acceleration. Acceleration is how fast the velocity is changing and velocity is how fast the position of something is changing. A concise way of writing which is which is the differential statement of a simple mass moving under a force.  If we also add the information that this body was sitting around at time then that would constitute the initial conditions which would determine the trajectory that the body would take for all subsequent . The boundary conditions come about when such differential equations are defined over a domain (). For instance, how does heat distribute from a central source (forcing function) on a disk shaped plate (this is ) when the boundary of the plate (this is the boundary of denoted by let's say ) is kept at a certain temperature (this is the boundary condition) given that the whole plate was at 20 degrees at the beginning constitutes a well defined mechanical problem which accepts a unique solution. The mathematical statement is the underlying differential equation of the problem on whose solution cannot always be found analytically. The way to go about it, which is rather general, is to transform it to what is called an integral form. This means that rather than trying to find a which exactly satisfies the differential equation subject to the initial and boundary conditions we try to find that u which minimizes the integral  for all suitably chosen functions . This process transforms the differential equation to its equivalent integral form and lies at the heart of the Finite Element Method. By applying the Gauss theorem, surface terms are taken into account which satisfy the boundary conditions. The integral form is also important as fundamental natural laws, as it turns out, can be equivalently expressed in differential or integral forms. For instance saying that Newton's laws holds is equivalent to saying that nature tends to minimize a certain quantity called action (built from potential energy and kinetic energy of the system) as the body moves from one state to another. This principle of least action is an integral representation of nature and can be used to derive the equations of motion of any system.

Anyway, as mentioned above, a reliable way of approximately solving differential equations is to transform them into integral equations and then using Finite Elements to solve them. Getdp is a general set of tools which help one do that. It admits the geometry of the problem through another free software called gmsh (or some other alternatives). Gmsh, by itself, looks like a powerful tool to create geometries and to mesh them. It has a programming language like structure so complicated actions can be carried out with relative ease. Getdp uses this geometry information and accepts the integral formulation of the problem at hand with the associated boundary and initial conditions. All this information is entered through special keywords and programmatic structures. Getdp then uses established Finite Element methods to find a solution to these equations. There appears to be a considerable amount of application of getdp+gmsh to electromagnetic problems but not nearly as much to elasticity problems. My effort would be to describe its application to such problems in the Codes section.

One degree of separation

I was walking around in the North East neighborhoods of Chicago amid the various fancy shops selling everything from Thai food to antiques, tiptoeing around the multitude which had came out to enjoy the fine summer evening when I felt the sting of the disconnect that I have felt time and again in myriad different forms as I have traversed the snaking path that life has taken over the last several years. It's a disconnect which prevents me from sharing in the various concerns which other people seem to have, enjoying the sources from which others seem to be able to derive happiness, and sympathize with their insecurities and belief systems. I have turned around and found upon closer examination that my experience of social interactions is often a degree removed from immediacy and is of a separation which is wide enough to ensure that the effect on me is at best a secondary one where everything is slightly muted, slightly subdued, slightly incredulous, and slightly cynical. The meta-investigation of what really lies behind the words and the faces is never too far for me and I cannot help but take things within the context of personalities which were perhaps created to especially suit the conversation. This is not to say that I feel that people need to be distrusted or that I am trying to uncover a deception. It's just an acknowledgment of the many insecurities that we all have, of the millions of faces that we put up to appear prim and proper, of the infinite little lies that we have convinced ourselves of. It's all very harmless and cute actually when you think about it, in a heartless sort of way and is the stuff which makes life and people colorful. And yet it is the sort of realization which prevents me from taking most things and most people too seriously, and the incredulity that I find myself experiencing when others appear too confident, too hopeful, too happy, too sad, or too serious. At these moments my incredulity springs not only from the knowledge, which I think is mostly correct, that life is fluid, almost meteorically fluid, and provides for such changes which are difficult to envisage beforehand and absolutely unknowable in their effects on us, but also from what I perceive are lacks of perspectives, spatial, temporal, and universal.

As hard as it is to take people too seriously, it is absolutely impossible to take groups of people with absolutely any degree of seriousness. I find that conversations with individuals are often very interesting and very colorful. There is always something to learn from them, even if it's just their experiences. Sometimes you can also come across those who even make sense. And even if that does not happen it is generally fun trying to find our ways in the night with a blindfold on. Groups of people with shared ideologies, however, have little going for them. Everyone seems to have sacrificed their identity in order to belong and what is left is a bland concoction of the lowest common denominator, very proper and very efficient, generally powerful and driven, but devoid of all qualities that may interest a sane (or insane, depending upon where you look from) person. It is this general blandness that I feel while walking around when I see people trying to fit in a certain lifestyle with their ridiculous buffed up gym bodies, their fancy glasses of cocktails, their expensive handbags and their stupid little rats of dogs. It is the precise blandness which I presume would permeate huge gatherings of religious people, or high powered financial offices with their jet-setting managers, or people who are fanatical supporters of issues so far removed from them that it's not even funny.

First lecture

I taught my first proper class this Tuesday. It's an undergraduate course called Introduction to Mechanics and as I was standing there in front of the students my mind could not help but reflect upon, in brief flashes of half-remembered memories, the days when I myself was a student in IIT (!) Guwahati. Those early mornings when the classes would start around 8 still linger in my memory as particularly harsh. And they only got harsher as the day progressed with classes and labs lined up one after another all the way up to 5 in the evening. I have still not been able to figure out what I learned from those classes since I barely remember anything taught in them. The problem, as I see now, was a combination of professors who were not very good at teaching and content which was not very interesting to me. The point of those courses, those semesters, and those years then was just to get the grades which were good enough to land something decent after graduation. And even this highly practical end goal of the studies which should instead have meant something deeper is a realization which I hardly ever made while I was an undergraduate. Perhaps there were others who saw further into the future but I don't remember having that kind of a foresight. I merely have memories of being adrift, almost a little incredulous of the situation that I found myself in, and slow to react in the larger scheme of things. I could not put it in words while my studies unfolded around me but hindsight has cleaned the dusty impression of intuition and crystallized the realization that I did not care too much about most of what was being taught. I went to the classes and gave the exams, even liked some things here and there, but it was only much later that I really came to appreciate the pleasure inherent in learning. And that kind of learning happened with no real goals in mind. It wasn't to get a great job, or to appear well read and educated, or to gain vaguely coherent sets of alphabets signifying murky accomplishments allowing one add a multitude of prefixes and suffixes to one's name. It was just because certain things were fun and interesting. Its pleasure was immediate, complete, and without any strings. It was a bit like taking the bike to North Torrey Pines beach which I used to do almost every evening for a couple of years. I never got bored of doing it even though everything remained exactly the same every day. Its pleasure was absolute to me and did not require any other reference frame for the justification of its magnitude. Its story was one which need not have been told ever again, one which was completely self content in its own silence and aloofness.

Wrinkled faces

I have been watching Ken Burns' 'Dust Bowl' documentary which basically is an amazing piece of work but what else do we expect from Burns anyway? Apart from the fact that one can learn a lot from it about a time in history which the modern America has been all too eager to forget, what struck me the most about it were the faces of the time. People who were kids then living with their parents on the prairie farms of Oklahoma, Kansas, east Colorado, and north Texas. Their families were trying to make a living out of growing wheat on what turned into immense dust fields through dust storms thousands of feet high. They tell their stories with touching fear of the hardships they had to face and nostalgia about the freedom of the vast expanse of the great American plains. You can almost see in their distant eyes the memories of the Sun setting over an oval horizon with nothing to obstruct the view save a shanty which their fathers built over farms which extended for thousands of acres. It is a beautiful and quiet image and one which draws me further into the romanticism of it all and irrevocably presents counterpoints in the current climate.

I quite like the stories of these people and I understand the essence of the broken lines which form those wrinkles. You can tell that these were people who really faced problems in their lives and they tried to make the best out of a really bad situation. You can feel that uprightness in them which you can find in those who have worked hard in their lives to surmount their issues. And you wonder, you cannot help but wonder, what is it in the current American life which compares to that kind of hardship. I have broad brushes with which I paint thick lines and sometimes my colors leak out from within the boundaries. With such a homogenized viewpoint, I find it impossible to take people's issues seriously in current America, a realization that is only growing as time passes. Of course people here have issues but if they only compared those across time and space... In relation to such things I have been occupying myself by working on my sneers and chuckles.

Bend in the river

I have finally made the move to my first proper job in what they say is the real world, joining the Mechanical, Materials, and Aerospace Engineering department at the Illinois Institute of Technology in Chicago as an Assistant Professor. The better part of last year was interesting, with a lot of words being entered in word documents and a lot of pdfs being created, with a lot of flying to places I had never been and meeting a lot of people whom I would perhaps not have met had it not being for the fact that they liked those pdfs which I had spent all that time creating. And upshot of it all, of all the flying and of all the meetings and of all the talks and seminars, of all those times which I spent in transit cities wondering if the inclement American winter weather would give me a break long enough for me to make my next flight, is that I have finally ended up in the quintessential American city of Chicago. It's only been a few days here but we all know how important first impressions area and mine have been really nice. But we have also been told not to judge a book by its covers so I will not. I will judge only when I have read her first few pages at least.

However, San Diego is a book which I have read from end to end, several times. I have spent the last eight years poring over its many ink blots and many purple passages. I have come to recognize the musty smell of its dusty Western hardbound and  its pages have turned dogeared between my fingers. I am intimately charmed by its yellowness and I remember its content from its page numbers. San Diego is a book that I can judge, perhaps not to the extent that some people can but more than a lot because of the time that I spent and the people that I came to know there. San Diego is a curious city. I honestly believe that if you live there, there can pretty much be no justification for being unhappy. It exists peacefully in that goldilocks zone of warm contentment which can provide you with surprisingly more than you expect from a city like it. Of course there are always bright young things who are mesmerized by the shiny facade of other places but I have come to take their hopes of happiness with a pinch of salt and a passing chuckle.  San Diego effortlessly provides diversity in demographics, eclecticism in arts, a vibrant outdoor culture, near-perfect weather, and the opportunity to lounge about on the beaches of the mighty Pacific every day. There are great things that one can do in places like New York or Chicago or San Francisco or Los Angeles, feeding off of the energy and creativity of the teeming milieu. One so inclined can probably write great novels and create great music at these places, inspired by their sharp edges. However, it probably is much easier to be happy in San Diego and that really is the argument to end all arguments.

In addition to landing in the perfect city for PhD I also had the great fortune of knowing some truly interesting and intelligent people there who have wittingly or unwittingly molded the rough draft of the personality that I began with in the US. Through my experience of knowing them I have come to appreciate a certain kind of person, one whose particulars cannot be stated but whose essence can be. They have substance to share and possess a certain depth of thought and view. They are about more than the next hot hangout or the next great financial investment. I have enjoyed the company of such people in San Diego and learned from them. So much so that I have no doubt that the years that I spent in San Diego have been the best years of my life, and the most formative ones. I look back at the company of those people with a genuine sense of gratitude, for having contributed to the exciting exchange which shapes personalities, to the invisible and complex hands of human interaction.

Loading...
X