Posts

Showing posts from November, 2016

Performance boost for GPU

I recently surfaced couple of ways to speed up GPU based application. I was experimenting with art transformation of images on a P2 class AWS machines. The process was taking anytime between 10 to 16 seconds, with an average of around 14 seconds. I was exploring, if time can be further optimized.
A brief chat with AWS resolved it for me. The AWS support guy asked me to set up my P2 per https://aws.amazon.com/blogs/aws/new-p2-instance-type-for-amazon-ec2-up-to-16-gpus/
I had done almost everything confirming to link above, except last 4 statements. Turns out, these commands configure some cool performance configurations.
Nvidia-smi (https://developer.nvidia.com/nvidia-system-management-interface) is a CLI for Nvidia GPU devices. As AWS P2 class server contain Nvidia Tesla K80 devices, I can use nvidia-smi to see and set options.
nvidia-smi -pm 1 The above option toggles Persistence Mode. It’s a GPU Attribute, which ensure Nvidia Driver remains loaded, even when an application is not runnin…

My personal GIT Cheat Sheet

Refresh a local working branch copy from origin $ git fetch --all
$ git reset --hard origin/master
Ignore given File in a Merge, e.g. defaults.php $ git merge --no-commit $ git reset HEAD myfile.txt $ git checkout -- myfile.txt $ git commit -m "merged "
Show history $ git log -p -2 -p, which shows the difference introduced in each commit. You can also use -2, which limits the output to only the last two entries
Go back to a previous version indicated by commitHash $ git reset --hard
Create a branch based off . Push the branch to remote repo $ git checkout -b $ git push --set-upstream origin
Ignore a file in Commit $ git add -u
$ git reset -- $ git commit -am “Log message”
Remove Untracked files and directories $ git clean -fd -n “d” is used here for directories. “n” is used to list, and not Remove as yet $ git clean -fd Remove the files & directories

HTTP works, HTTPS does not, on AWS

Image
Spent half a day figuring the issue on why all HTTP requests works, but HTTPS does not. Writing this Post on my journey from Oh Man!! to Wow Man!!
I am on AWS with following configuration EC2 instance with application code ELB load balancer SSL certificate from Amazon, attached to ELB
Used Postman for the request. None of the HTTP / HTTPS works. Postman returns a canned message with following troubleshooting options. Refer image Check server for response SSL connection blocked Cookies issue Request timeout


As request works fine in Browser, 1 is not applicable. Checked Server configuration and ruled out 2. 3 is not applicable. Increased timeout, but still couldn’t get it work.
Tried another Chrome REST client extension (DHC REST Client) to add variety to the test. HTTP works, HTTPS still does not work. Some progress.
Suspecting SSL Certificate, deleted it, created a new one. Attached it to the Load Balancer, but still HTTPS does not work.
Suspecting Load Balancer, deleted it, created a new one…

Animated GIF on Static Photo

Today, I will talk about a nifty trick to integrate animated GIFs in static Photos. Static images can be placed over Static photos in Snapchat, Instagram and Whatsapp. However, we will learn the technique to add animated sticker(s), aka GIF, over a photo.
The final photo will have both the visuals integrated. We will use following steps Extract frames from GIF* Place Frame 1 on static Photo Place Frame 2 on another copy of static Photo Repeat step 3, until all frame are placed Finally, take all static Photos from above steps, and create an animated GIF
To put multiple stickers on a photo, do following Extract frames from all GIFs Find GIF with maximum number of frames Loop through with termination counter set to number from Step 2 Add counters for other GIFs (e.g., GIF2 containing 3 frames, j=0) Place frame i (GIF1 frame), j (GIF2 frame), k (GIF3 frame) etc., on static Photo