I posted an article about my new graphic card, GTX750. I have been using it for a while and I am loving it so much. The temperature of the graphic card is so low even during a heavy 3D game play.
Assuming that I can trust the numbers from RealTemp, the temperature range of GTX750 is between 25 celsius degree to 40 celsius degree. It is surprisingly low.
My previous graphic card, GTX280, was between 75 celsius degree and 110 celsius degree. My Intel i7 quad-core CPU is between 50 and 100 celsius degree. So below 40 degree temperature is very surprising with the fact that the graphic card performance is better than what I had before.
However, the fan on graphic card made by EVGA is making little high pitch noise when I play game. I wish the fan was little bigger and making lower tone noise.
Aug 3, 2014
Jul 27, 2014
I created a new Blog
I created a new blog, Raspberry Pi Programming. I am planning to fill it up with some RPi related programming; or Linux/Web programming in general.
I liked the auto-generated new skin. It is wider and it can show longer lines of code.
One of the reasons I created a new Blog is that Google said my current Blog contains copyright material, which they didn't exactly point out. So I am hoping that I can learn and be more sensitive about copy-right materials by managing the new blog.
Also I like to develop my programming skills in Linux/Web based platform more.
I liked the auto-generated new skin. It is wider and it can show longer lines of code.
One of the reasons I created a new Blog is that Google said my current Blog contains copyright material, which they didn't exactly point out. So I am hoping that I can learn and be more sensitive about copy-right materials by managing the new blog.
Also I like to develop my programming skills in Linux/Web based platform more.
Jul 25, 2014
A try with Autotools, EclipseCDT and MingW
I am a big fan of GNU utilities but I have never had a chance to use "Autotools" before. Autotools is a tool set for generating Makefile/configure. As far as I know, autotools checks what kind of OS/compiler characteristics have such as byte-endian-ness or the size of boolean. And it generates Makefile depending on the characteristics.
A few days ago, I found that Eclipse CDT has a project template for GNU autotools, so I tried it. It seems that I have been following instructions from web pages but I am stuck at some point. It shows me this error message:
I am thinking that it may be a bug in CDT not working with my MingW. I may need to try Cygwin instead.
A few days ago, I found that Eclipse CDT has a project template for GNU autotools, so I tried it. It seems that I have been following instructions from web pages but I am stuck at some point. It shows me this error message:
Generating Makefile in build directory: C:/Users/wrice/workspace/cpp/camd/Somehow the autotool successfully generated a file, "configure". But it cannot execute because the path is wrong. The folder path is repeated twice: "C:/Users/wrice/workspace/cpp/camd/C/Users/wrice/workspace/cpp/camd/configure".
sh -c "C:/Users/wrice127/workspace/cpp/camd/C/Users/wrice127/workspace/cpp/camd/configure CFLAGS=\"-g\""
sh: C:/Users/wrice127/workspace/cpp/camd/C/Users/wrice127/workspace/cpp/camd/configure: No such file or directory
Configuration failed with error
I am thinking that it may be a bug in CDT not working with my MingW. I may need to try Cygwin instead.
Jul 23, 2014
Finite State Machine in programming language
Finite State Machine is very powerful and well-known concept in computer science. However it is not well-integrated into any programming language. When it is expressed with UML diagram, it is often effectively represent how the state relationship changes. I have been looking for a solution for utilizing the power of finite state machine in programing language level.
Here is an example of a simple state machine, taken from Wiki.
When you think about how to express it in a plain text, it is not an easy task because those relation ship is not one-dimensional or one-directional.
I was able to find several different notations for FSM but I found SCXML most promising.
http://en.wikipedia.org/wiki/SCXML
The UML above can be written in an XML:
If we can automatically generate the set of interface from a SCXML, it will be very useful.
In Java, fortunately, there is a compile time "annotation" so that I can execute my own Java program at compile time through java compiler. Most of time the feature is used to map SQL table and Java class member variables. I think it should work for my idea as well.
I have another example of file handler.
The problem of traditional file handle wrapping classes is that it has several methods and they are allowed to be used anytime. For example, even though "open()" method must be called before "read()" or "write()", there is no way for compiler to force it. This problem can be addressed by state machine.
This SCXML can be (automatically) translated to a set of interface; except the OpenAction part below:
The set of interface can be used like this:
Note that I used lamda expression with a functional interface, "OpenAction", which is recent new feature from JDK-8.
Up to this point, it sounds good but there is a down-side I am reluctant to mention. This type of approach will make the implementation part more complicated; in the case of FileHandler example, the implementation class, "FileHandler_FiniteStateMachineImpl", will be more complicated than traditional file handling classes. It is due to the over-head of wrapping state with new objects. Performance-wise, it wouldn't be much different but the number of source code lines will be increased so does the difficulty of maintainability.
I am hoping that I can come up with better idea of suppressing the complexity over-head with the awesome compile-time annotation feature.
Here is an example of a simple state machine, taken from Wiki.
When you think about how to express it in a plain text, it is not an easy task because those relation ship is not one-dimensional or one-directional.
I was able to find several different notations for FSM but I found SCXML most promising.
http://en.wikipedia.org/wiki/SCXML
The UML above can be written in an XML:
< ?xml version="1.0" encoding="UTF-8"?>
< scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initial="ready">
< state id="ready">
< transition event="watch.start" target="running"/>
< /state>
< state id="running">
< transition event="watch.split" target="paused"/>
< transition event="watch.stop" target="stopped"/>
< /state>
< state id="paused">
< transition event="watch.unsplit" target="running"/>
< transition event="watch.stop" target="stopped"/>
< /state>
< state id="stopped">
< transition event="watch.reset" target="ready"/>
< /state>
< /scxml>
Now I want to translate the state machine into a programing language and I want to force the state at compile time.package stateMachine;public interface Watch_FiniteStateMachine {The set of interface will be used like this:
public StartingState initial();
public StoppedState finalState();
static public interface StartingState {
public RunningState start();
}
static public interface RunningState {
public PausedState pause();
public StoppedState stop();
}
static public interface PausedState {
public RunningState resume();
public StoppedState stop();
}
static public interface StoppedState {
}
}
Watch_FiniteStateMachine watchFSM = new Watch_FiniteStateMachineImpl();This is a simple case but it shows that the state change is determined at compile time. Since there is no way for us to get "PausedState" object until we get "RunningState", the order of state machine is forced at compile time.
StartingState watchStarting = watchFSM.initial();
RunningState watchRunning = watchStarting.start();
PausedState watchPaused = watchRunning.pause();
StoppedState watchStopped = watchPaused.stop();
If we can automatically generate the set of interface from a SCXML, it will be very useful.
In Java, fortunately, there is a compile time "annotation" so that I can execute my own Java program at compile time through java compiler. Most of time the feature is used to map SQL table and Java class member variables. I think it should work for my idea as well.
I have another example of file handler.
The problem of traditional file handle wrapping classes is that it has several methods and they are allowed to be used anytime. For example, even though "open()" method must be called before "read()" or "write()", there is no way for compiler to force it. This problem can be addressed by state machine.
< scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initial="readyToOpen">
< state id="readyToOpen">
< transition event="openForRead" target="reading"/>
< transition event="openForWrite" target="writing"/>
< transition event="openForReadAndWrite" target="readingAndWriting"/>
< /state>
< state id="reading">
< transition event="close" target="readyToOpen"/>
< /state>
< state id="writing">
< transition event="close" target="readyToOpen"/>
< /state>
< state id="readingAndWriting">
< transition event="close" target="readyToOpen"/>
< /state>
< /scxml>
This SCXML can be (automatically) translated to a set of interface; except the OpenAction part below:
public interface FileHander_FiniteStateMachine {
public ReadyToOpenState initial();
static public interface ReadyToOpenState {
static public interface OpenAction {
public void action(String line);
}
public ReadingState openForRead(String filename, OpenAction action);
public WritingState openForWrite(String filename, OpenAction action);
public ReadingAndWritingState openForReadAndWrite( String filename, OpenAction action);
}
static public interface ReadingState {
public ReadyToOpenState close();
}
static public interface WritingState {
public ReadyToOpenState close();
}
static public interface ReadingAndWritingState {
public ReadyToOpenState close();
}
}
The set of interface can be used like this:
FileHander_FiniteStateMachine fileFSM = new FileHander_FiniteStateMachineImpl();
ReadyToOpenState fileReady = fileFSM.initial();
ReadingState fileReading = fileReady.openForRead("filename.txt",
line -> System.out.println(line));
ReadyToOpenState fileReadyAgain = fileReading.close();
Note that I used lamda expression with a functional interface, "OpenAction", which is recent new feature from JDK-8.
Up to this point, it sounds good but there is a down-side I am reluctant to mention. This type of approach will make the implementation part more complicated; in the case of FileHandler example, the implementation class, "FileHandler_FiniteStateMachineImpl", will be more complicated than traditional file handling classes. It is due to the over-head of wrapping state with new objects. Performance-wise, it wouldn't be much different but the number of source code lines will be increased so does the difficulty of maintainability.
I am hoping that I can come up with better idea of suppressing the complexity over-head with the awesome compile-time annotation feature.
Jul 21, 2014
Private browsing in Firefox
Recently I learn about Private Browsing feature in Firefox web browser; it doesn't store any password or browsing history.
First I thought that where I can possibly use it for.
Later I found it handy at work; or I can use it when I borrow my wife's computer or something.
I shouldn't be but it happens from time to time that I check Amazon, check my emails or check YouTube videos. I don't want to store any record of them.
First I thought that where I can possibly use it for.
Later I found it handy at work; or I can use it when I borrow my wife's computer or something.
I shouldn't be but it happens from time to time that I check Amazon, check my emails or check YouTube videos. I don't want to store any record of them.
Jul 18, 2014
I got a new graphic card, GTX750
I got a new graphic card, GTX750. This is a low-end graphic card that is made by NVidia. The reason why I picked this graphic card is because it is designed to consume low power. Most of other graphic cards consumes about 150~250W while GTX750 consumes only 55W. The performance is little less than half of high-end graphic card but I think it is still strong enough to run most of Steam games. At worst case, I can reduce shadow map size or adjust some other options to get better performance. The price was also cheap; I got it at $120 from Fry's and it came with $20 rebate by mail.
*PS: image from http://www.geforce.com/hardware/desktop-gpus/geforce-gtx-650/product-images
*PS: image from http://www.geforce.com/hardware/desktop-gpus/geforce-gtx-650/performance
Recently I have been thinking that I should use more computer than just playing games. I used to write a lot and read more. But I am not doing them.
Last two years, I spent a lot of time commuting; five hours a day. Last December my wife and I agreed to move to a place close to my company. Since then, I got some free time back and I have been playing games. Recently I realized that I could have spent it better wisely. Once we have a baby, I wouldn't have time for myself again. So I have been trying to move from console to my desktop computer.
The problem I found was that my desktop computer is so loud. It might be fine a few years ago but since I got used to small and silent devices like RaspberryPi, Tablets and PlayStation, I couldn't bear the noise from my computer. It was also super hot after one or two hours later. I kept looking for a solution and a few days ago I found this awesome cool graphic card, GTX750. It took only two hours for me to get one after I learned about it. Also I took out my SSD drive from another computer and installed it on the desktop computer. I adjusted fan speed little bit and vacuumed inside of the computer. After all the effort, it still makes some fan noise but it is about the level I may be able to take. If it still bother me, I may try turning of one of five fans, replacing the power supply or replacing the CPU cooler with water cooling device. BTW, noise canceling headset certainly helps.
*PS: image from http://www.geforce.com/hardware/desktop-gpus/geforce-gtx-650/product-images
*PS: image from http://www.geforce.com/hardware/desktop-gpus/geforce-gtx-650/performance
Recently I have been thinking that I should use more computer than just playing games. I used to write a lot and read more. But I am not doing them.
Last two years, I spent a lot of time commuting; five hours a day. Last December my wife and I agreed to move to a place close to my company. Since then, I got some free time back and I have been playing games. Recently I realized that I could have spent it better wisely. Once we have a baby, I wouldn't have time for myself again. So I have been trying to move from console to my desktop computer.
The problem I found was that my desktop computer is so loud. It might be fine a few years ago but since I got used to small and silent devices like RaspberryPi, Tablets and PlayStation, I couldn't bear the noise from my computer. It was also super hot after one or two hours later. I kept looking for a solution and a few days ago I found this awesome cool graphic card, GTX750. It took only two hours for me to get one after I learned about it. Also I took out my SSD drive from another computer and installed it on the desktop computer. I adjusted fan speed little bit and vacuumed inside of the computer. After all the effort, it still makes some fan noise but it is about the level I may be able to take. If it still bother me, I may try turning of one of five fans, replacing the power supply or replacing the CPU cooler with water cooling device. BTW, noise canceling headset certainly helps.
Apr 11, 2014
Outlook 2010 Visual Basic Script on Rule
I found that Microsoft Outlook gives us a way to run a Visual Basic Scripts.
I was hard to search a good sample script and this was the best one I have found.
The example shows how to iterate all of "conversation" in a give MailItem.
The script can be executed on Rule.
I was hard to search a good sample script and this was the best one I have found.
http://code.msdn.microsoft.com/office/Outlook-2010-Manipulate-64fead5e
The example shows how to iterate all of "conversation" in a give MailItem.
The script can be executed on Rule.
Apr 9, 2014
I had a chance to enjoy C++11
I had a chance to enjoy C++11 for a few days. I liked std::thread and std::mutex. Now I don't need to borrow thread implementation from MIT p-thread or Boost anymore. I heard file system stuff is very fun to play with but I didn't have chance for that yet.
Lamda expression is fun but I feel little dangerous. It reminded me of the syntax of Perl; more specifically the implicit variable, "$_". It is a powerful toy but it can easily make other programmers suffer from the complex and dense program code.
I am inspired and excited enough to think about making some small programs on Raspberry Pi with C++11. However, it seems that C++11 doesn't have any network features yet.
*PS: BTW, isn't Java new version coming out soon?
Lamda expression is fun but I feel little dangerous. It reminded me of the syntax of Perl; more specifically the implicit variable, "$_". It is a powerful toy but it can easily make other programmers suffer from the complex and dense program code.
I am inspired and excited enough to think about making some small programs on Raspberry Pi with C++11. However, it seems that C++11 doesn't have any network features yet.
*PS: BTW, isn't Java new version coming out soon?
Apr 6, 2014
Two player games with MK802IV
After little more struggling, I was able to play two player fighting games with MK802IV. As I described, when I attached two gamepads, only one of them was responsive. I had to find a way to control the second player with Wifi.
I tried RemoteDroid but it required a Kernel that is compiled with uinput. Mine didn't have it and I didn't want to downgrade it.
The factory firmware was shipped with an interesting remote controlling software called "RkGameController". It is a server side input system and there was a client app, "RkRemoteControl". It looks like this:
Now I can play the first player with wired XBox360 controller and the second player with my 7inch KindleHdx via Wifi.
I found a Video that demonstrate how RkRemoteControl works:
A tricky part was that I couldn't figure out how to use "Game controller" mode in RkRemoteControl. On client side, I can reposition buttons but I didn't know why I had to reposition buttons on the server side. It turned out that this game controller mode doesn't send key press but it works as touch pad. It remaps touching position data. It still rely on the overlay gamepad feature from FPse.
The re-mapping touchpad screen is very clever but I almost missed it; I am glad I didn't. If the video was verbally explaining what the Chinese was doing, it could be much easier. lol
I tried RemoteDroid but it required a Kernel that is compiled with uinput. Mine didn't have it and I didn't want to downgrade it.
The factory firmware was shipped with an interesting remote controlling software called "RkGameController". It is a server side input system and there was a client app, "RkRemoteControl". It looks like this:
Now I can play the first player with wired XBox360 controller and the second player with my 7inch KindleHdx via Wifi.
I found a Video that demonstrate how RkRemoteControl works:
A tricky part was that I couldn't figure out how to use "Game controller" mode in RkRemoteControl. On client side, I can reposition buttons but I didn't know why I had to reposition buttons on the server side. It turned out that this game controller mode doesn't send key press but it works as touch pad. It remaps touching position data. It still rely on the overlay gamepad feature from FPse.
The re-mapping touchpad screen is very clever but I almost missed it; I am glad I didn't. If the video was verbally explaining what the Chinese was doing, it could be much easier. lol
PlayStation One emulator, FPse, runs on MK802 IV with many issues.
I believe it was last July. I ordered an interesting Android device called, MK802 IV, made by RikoMagic: http://en.wikipedia.org/wiki/Android_Mini_PC_MK802.
I was comparing the video play performance to Raspberry Pi. The hardware spec seemed much better because MK802 IV had quad core CPU and 2GB memory while Raspberry Pi has a known to be weak CPU and 512MB memory. From my simple movie play testing, Raspberry Pi was much faster for high definition video play. I think it was because Raspberry Pi has dedicated Hardware video decoding unit.
I was disappointed because it was double times more expensive than Raspberry Pi and whatever I was trying to do, it was super frustrating due to software issues. Many documents were written in Chinese and I couldn't find official firmware downloading website.
I put it in a box and forgot about it until last Friday. What I thought was that it may do better job on Play Station One emulator because it has good CPU power. I tried psx_ReArmed on Raspberry Pi but the CPU wasn't strong enough to emulate it. One of PlayStationOne emulators, FPse, was running very well on MK802 IV. There were some frame drops but it was still playable. I was happy to see old familiar games.
I thought I can take another step further. I was trying to use two gamepads but it didn't go well.
Although it is still not perfect, I am still happy about the fact that I can enjoy old good games.
I was comparing the video play performance to Raspberry Pi. The hardware spec seemed much better because MK802 IV had quad core CPU and 2GB memory while Raspberry Pi has a known to be weak CPU and 512MB memory. From my simple movie play testing, Raspberry Pi was much faster for high definition video play. I think it was because Raspberry Pi has dedicated Hardware video decoding unit.
I was disappointed because it was double times more expensive than Raspberry Pi and whatever I was trying to do, it was super frustrating due to software issues. Many documents were written in Chinese and I couldn't find official firmware downloading website.
I put it in a box and forgot about it until last Friday. What I thought was that it may do better job on Play Station One emulator because it has good CPU power. I tried psx_ReArmed on Raspberry Pi but the CPU wasn't strong enough to emulate it. One of PlayStationOne emulators, FPse, was running very well on MK802 IV. There were some frame drops but it was still playable. I was happy to see old familiar games.
I thought I can take another step further. I was trying to use two gamepads but it didn't go well.
- First problem was that although the manufacture didn't mention it, it wasn't able to provide enough power to two USB gamepads. It seems like one gamepad was limit without a USB hub that can supply additional power.
- Second problem was that even though I solve power issue, one of gamepad was stuttering a lot. Only one gamepad was working smoothly. This means no two player games. I still don't know if it is my device only issue or Android general issue.
- Third problem was where I wasted most of time. MK802 IV has built-in Bluetooth but rumor is that BT feature is not fully implemented. I was trying to use my PS3 controller via the Bluetooth. I found many people gave up. I could give up early and save some time. This means no wireless controllers.
Although it is still not perfect, I am still happy about the fact that I can enjoy old good games.
Apr 5, 2014
I ordered Amazon Fire TV yesterday. We got a new 60inch Samsung TV last week but it wasn't smart TV and it had no fancy features at all. So I was looking for any "smarter TV" devices.
I wanted to do four things with my new TV client: NetFlix, PC/Tablet mirroring, casual gaming and XBMC; in order of priority from high to low.
Candidates were Chromecast($35), RaspberryPi($40), Ouya($90), Roku3($99) and AmazonFireTV($99).
I have been enjoying XBMC with my RaspberryPi for more than a year already. I love it and I cannot live a day without it. But most of time XBMC doesn't go along with NetFlix. NetFlix has been intentionally banning Hackable devices in order to protect their digital contents. So NetFlix doesn't run on any Linux devices while XBMC runs on most of hackable devices. I haven't seen any devices that runs both except Windows PC. Because of the reason, I am giving up XBMC this time.
I listed descriptions of candidates in order of the price. But if I sort it in order of my priority, AmazoneFireTV, Roku3 and Chromecast come up to the top, because they run NetFlix.The difference among them is on gaming. AmazoneFireTV won.
As I wrote as few days ago, I found that it doesn't feel good to play casual games on PlayStation3/4 or PC. It feels wrong to play such simple games with high horse power devices. So gaming on TV client seems like a good approach. At least I like to try.
I wanted to do four things with my new TV client: NetFlix, PC/Tablet mirroring, casual gaming and XBMC; in order of priority from high to low.
Candidates were Chromecast($35), RaspberryPi($40), Ouya($90), Roku3($99) and AmazonFireTV($99).
I have been enjoying XBMC with my RaspberryPi for more than a year already. I love it and I cannot live a day without it. But most of time XBMC doesn't go along with NetFlix. NetFlix has been intentionally banning Hackable devices in order to protect their digital contents. So NetFlix doesn't run on any Linux devices while XBMC runs on most of hackable devices. I haven't seen any devices that runs both except Windows PC. Because of the reason, I am giving up XBMC this time.
- Chromecast is the cheapest solution for NetFlix and it does web browser mirroring. But there is no way to run XBMC on the device.
- RaspberryPi runs XBMC but no NetFlix. Because RaspberryPi had GPU, it is able to run some casual games such as game console emulators. But it is running Linux not Android so GUI applications are limited.
- Ouya has powerful NVidia Tegra3 GPU chip and it is a gaming console that can run PlayStation one emulator as well as all the other older gaming console emulators. It comes with a nice bluetooth wireless game controller, which can value about $40. It runs XBMC well and NetFlix too. It is almost perfect for my need but I heard that NetFlix support is poor because the device is hackable and NetFlix doesn't support it well.
- Roku3 can run NetFlix but not XBMC. It seems that Roku is not a hackable device. Some said it can do some mirroring but some said it is not screen mirroring. It doesn't have GPU and it is not for gaming. It runs on Android so I am sure it had plenty of good apps.
- AmazonFireTV has a good hardware spec. It runs NetFlix and it is able to do some good gaming. It seems that XBMC is not running well at this point but some said that Ouya version of XBMC runs well. It is strange because Ouya has ARM CPU and AmazonFireTV has snapdragon but it sounds promising so far. I am not sure about mirroring feature yet but I may be able to find some Android app for my need.
I listed descriptions of candidates in order of the price. But if I sort it in order of my priority, AmazoneFireTV, Roku3 and Chromecast come up to the top, because they run NetFlix.The difference among them is on gaming. AmazoneFireTV won.
As I wrote as few days ago, I found that it doesn't feel good to play casual games on PlayStation3/4 or PC. It feels wrong to play such simple games with high horse power devices. So gaming on TV client seems like a good approach. At least I like to try.
PDB file can be accessed with Dia SDK
I was looking for a way to gather useful data from .PDB files. Here PDB mean Program DataBase. It is generated from Visual Studio C++ for debugging.
It seems that Microsoft provides SDK for PDB files. It is called "Debug Information Access SDK" or "Dia SDK". Although it requires some programming, it doesn't seem too hard; an example.
On the other hand, there is a set of utilities for Linux binary format, ELF. It is called "BinUtils". It doesn't require any programming and it works well with shell scripting. I wish there is a BinUtils for PDB too.
It seems that Microsoft provides SDK for PDB files. It is called "Debug Information Access SDK" or "Dia SDK". Although it requires some programming, it doesn't seem too hard; an example.
On the other hand, there is a set of utilities for Linux binary format, ELF. It is called "BinUtils". It doesn't require any programming and it works well with shell scripting. I wish there is a BinUtils for PDB too.
Mar 27, 2014
SPU operation dual issue
Today I learned how to manually calculate SPU operation dual issue rate. One of documents SPU document explained it very well.
There are two different types of operations: Even and Odd. When Even operation and Odd operation are fetched together they can be dual-issued. Each operation consists of 4bytes and OPCODE is most of time significant 11bits; the PDF document has list of instructions with their OPCODEs.
There is an important alignment limitation. When Even operations are stored in odd memory address or Odd operations are stored in even memory address, they cannot be dual-issued. Here the term, Even address means, any address value whose 3rd bits from LSB is zero; one for Odd address. For example, 0xXXX0, 0xXXX1, 0xXXX2 and 0xXXX3 belong to Even address.
Each operation size is 4byte and instruction fetching occurs for each 8bytes. For example, address from 0xXXX0 to 0xXXX7 will be fetched at once and address from 0xXXX8 to 0xXXXF will be fetched next.
When Even operation is stored at Odd address, 0xXXX4~0xXXX7 or 0xXXXC~0xXXXF, it will prevent the fetched instructions from being dual issued. Likewise, when Odd operation is stored at even adress, 0xXXX0~0xXXX3 or 0xXXX8~0xXXXB, it will prevent too. Whenever dual-issuing fails, one of pipeline units stalls.
I remember reading the same thing from one of articles in the book, "GPU pro". But I have almost forgotten it.
There are two different types of operations: Even and Odd. When Even operation and Odd operation are fetched together they can be dual-issued. Each operation consists of 4bytes and OPCODE is most of time significant 11bits; the PDF document has list of instructions with their OPCODEs.
There is an important alignment limitation. When Even operations are stored in odd memory address or Odd operations are stored in even memory address, they cannot be dual-issued. Here the term, Even address means, any address value whose 3rd bits from LSB is zero; one for Odd address. For example, 0xXXX0, 0xXXX1, 0xXXX2 and 0xXXX3 belong to Even address.
Each operation size is 4byte and instruction fetching occurs for each 8bytes. For example, address from 0xXXX0 to 0xXXX7 will be fetched at once and address from 0xXXX8 to 0xXXXF will be fetched next.
When Even operation is stored at Odd address, 0xXXX4~0xXXX7 or 0xXXXC~0xXXXF, it will prevent the fetched instructions from being dual issued. Likewise, when Odd operation is stored at even adress, 0xXXX0~0xXXX3 or 0xXXX8~0xXXXB, it will prevent too. Whenever dual-issuing fails, one of pipeline units stalls.
I remember reading the same thing from one of articles in the book, "GPU pro". But I have almost forgotten it.
Mar 25, 2014
RetroPie is great.
My wife told me that she want to play Super Mario Bro that she used to play in her friend's house. I thought about getting an ArcadePi but it was too expensive. So I just installed "RetroPie" in one of my RaspberryPis: http://blog.petrockblock.com/retropie
I never thought that I will enjoy old games. But when I put my hands on, I liked Super Mario Bro a lot. The graphic looks old and it uses only limited number of colors but it was simple and straight forward; even my wife can enjoy games!
I started looking for other old games. I found that there are so many good games that runs on emulators. For example, this website lists so many good PS1 games: http://www.gamesradar.com/best-psx-games. It reminded me of time I spend in arcade game centers with my friends. These games are actually not that old games. The last PS1 game I remember is Final Fantasy 9, which was made in 2000.
I think the fun factor of the game was little different from what we have now. I had to put coins in the machine and I wanted to play longer. If I play better, I didn't need to spend too much money and I coul enjoy later part of the game. So "Play skillfully" was important. Now a days we play games at home most of time and skillfully is less important, because there is no fear of spending money. Also the games were more casual and intuitive. I guess it is the characteristics of "casual games" in general.
It may be only me but if I play "casual games" with my PlayStation3/4, it feels like I am doing a wrong thing. With such a powerful machine, why would I play casual games? Wouldn't it be a waste? It is like commuting with a school bus by myself. So it is actually preventing me from playing casual games. In my mind set, I don't have way to play casual games.
The point is that old games reminded me of something that I have forgotten for long time for long time. I tried to write down this to think louder. lol
I never thought that I will enjoy old games. But when I put my hands on, I liked Super Mario Bro a lot. The graphic looks old and it uses only limited number of colors but it was simple and straight forward; even my wife can enjoy games!
I started looking for other old games. I found that there are so many good games that runs on emulators. For example, this website lists so many good PS1 games: http://www.gamesradar.com/best-psx-games. It reminded me of time I spend in arcade game centers with my friends. These games are actually not that old games. The last PS1 game I remember is Final Fantasy 9, which was made in 2000.
I think the fun factor of the game was little different from what we have now. I had to put coins in the machine and I wanted to play longer. If I play better, I didn't need to spend too much money and I coul enjoy later part of the game. So "Play skillfully" was important. Now a days we play games at home most of time and skillfully is less important, because there is no fear of spending money. Also the games were more casual and intuitive. I guess it is the characteristics of "casual games" in general.
It may be only me but if I play "casual games" with my PlayStation3/4, it feels like I am doing a wrong thing. With such a powerful machine, why would I play casual games? Wouldn't it be a waste? It is like commuting with a school bus by myself. So it is actually preventing me from playing casual games. In my mind set, I don't have way to play casual games.
The point is that old games reminded me of something that I have forgotten for long time for long time. I tried to write down this to think louder. lol
Mar 16, 2014
I got TonTec 2.4inch LCD monitor for Raspberry Pi
Last week I found an small and very thin LED monitor, "HL161ABB". I thought I can use it for one of my RaspberryPis. It was LED and I has VGA port not HDMI port. It was super thin and the price was only $70.
However, I also found an interesting LCD monitor for Pi. It was Tontec 2.4inch 320x240 LCD monitor connected via GPIO. The "GPIO" part is the best part of the product. It doesn't require any additional power supply and it turned out that I can still use USB keyword and USB Wifi with no power problem. Compare to "HL161ABB", the price is too high, $45, but I got it because of the GPIO part.
I was thinking to run arcade game with the LCD attached Pi. I found a problem tho. It was utilizing CPU resource to copy the video frame buffer too much. CPU utilization was almost always at max.
The source code was very simple and straight forward; about 80lines. It reads /dev/fp0 and checks if the colors are changed and if it did, it changes the color value on the LCD. It seems like the LCD displays 16bit colors, which means it takes R5G6B5 instead of full R8G8B8.
But I was wondering if it can utilize GPU rather than CPU not only for speed up but also for saving CPU availability for other applications.
I am tempted to optimize the source code but I need to figure out if there are better versions or if anybody have done it already. The source code had a URL advertisement like this:
printf ("http://jwlcd-tp.taobao.com\n") ;
It turned out that it is a Chinese website. I was hoping that if they made any new version of the software but I couldn't read a thing.
However, I also found an interesting LCD monitor for Pi. It was Tontec 2.4inch 320x240 LCD monitor connected via GPIO. The "GPIO" part is the best part of the product. It doesn't require any additional power supply and it turned out that I can still use USB keyword and USB Wifi with no power problem. Compare to "HL161ABB", the price is too high, $45, but I got it because of the GPIO part.
I was thinking to run arcade game with the LCD attached Pi. I found a problem tho. It was utilizing CPU resource to copy the video frame buffer too much. CPU utilization was almost always at max.
The source code was very simple and straight forward; about 80lines. It reads /dev/fp0 and checks if the colors are changed and if it did, it changes the color value on the LCD. It seems like the LCD displays 16bit colors, which means it takes R5G6B5 instead of full R8G8B8.
But I was wondering if it can utilize GPU rather than CPU not only for speed up but also for saving CPU availability for other applications.
I am tempted to optimize the source code but I need to figure out if there are better versions or if anybody have done it already. The source code had a URL advertisement like this:
printf ("http://jwlcd-tp.taobao.com\n") ;
It turned out that it is a Chinese website. I was hoping that if they made any new version of the software but I couldn't read a thing.
Feb 11, 2014
Foscam and Raspberry IP network sharing with wired LAN
I spent sometime to get this working and I want to share what I figured. I wanted to set a Raspberry Pi to be a network sharing device.
The setting was (a) Foscam IP camera is connected to (b) Raspberry Pi with eth0 wired LAN cable. And (b) the Raspberry Pi is connected to internet via wifi, wlan0.
I wanted to access web port of (a) Foscam IP camera via a port, 80, on (b) Raspberry Pi.
Here is MASQUERADE setting that should be stored in /etc/rc.local. The IP address of (a) Foscam IP camera in this setting is 192.168.1.80.
This setting is learned from a website, here.
The setting was (a) Foscam IP camera is connected to (b) Raspberry Pi with eth0 wired LAN cable. And (b) the Raspberry Pi is connected to internet via wifi, wlan0.
I wanted to access web port of (a) Foscam IP camera via a port, 80, on (b) Raspberry Pi.
Here is MASQUERADE setting that should be stored in /etc/rc.local. The IP address of (a) Foscam IP camera in this setting is 192.168.1.80.
# Enable ip forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
# Clear all existing iptables rules
/sbin/iptables -F
/sbin/iptables -t nat -F
/sbin/iptables -t mangle -F
# Create new rules for routing between your wireless and wired connection
/sbin/iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
/sbin/iptables -A FORWARD -i wlan0 -p tcp --dport 80 -d 192.168.1.80 -j ACCEPT
/sbin/iptables -A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -i wlan0 -p tcp --dport 80 -j DNAT --to 192.168.1.80
This setting is learned from a website, here.
Changes after Foscam firmware upgrade
It took sometime for me to figure out what was going on.
It seems like after upgrading the firmware of Foscam camera to the latest, 11.37.2.54, "get_params.cgi" was gone. It is replaced with "get_status.cgi".
It looks like this:
It seems like after upgrading the firmware of Foscam camera to the latest, 11.37.2.54, "get_params.cgi" was gone. It is replaced with "get_status.cgi".
It looks like this:
$ wget -q -S -O - http://192.168.1.80/get_status.cgi\?user=admin\&pwd=pass
HTTP/1.1 200 OKI don't know what else is changed.
Server: Boa/0.94.13
Date: Tue, 11 Feb 2014 09:14:36 GMT
Content-Type: text/plain
Content-Length: 361
Cache-Control: no-cache
Connection: close
var id='00626E46F948';
var sys_ver='11.37.2.54';
var app_ver='2.0.10.7';
var alias='foscam01';
var now=1392110076;
var tz=28800;
var alarm_status=0;
var ddns_status=0;
var ddns_host='';
var oray_type=0;
var upnp_status=0;
var p2p_status=0;
var p2p_local_port=24937;
var msn_status=0;
var wifi_status=0;
var temperature=0.0;
var humidity=0;
var tridro_error='';
Jan 28, 2014
Auto reactivate wifi on raspberry pi
One of my raspberry pi was having trouble auto reconnectiong to home wifi when wifi router starts. I made a simple script to re-activate wifi.
* * * * * wifi.sh
It will check the wifi every minute and reactive when the wifi is down.
You can also test it by manually deactivating it: sudo ifdown wlan0.
If it comes up by itself after one minute later, the setting is working.
#!/bin/shIt will have to be registered on crontab of root:
stat=`/sbin/ifconfig wlan0 | /bin/grep -q "inet addr:"`
if [ $? -ne 0 ]
then
echo "Wifi restarting..."
/sbin/ifup --force wlan0
fi
* * * * * wifi.sh
It will check the wifi every minute and reactive when the wifi is down.
You can also test it by manually deactivating it: sudo ifdown wlan0.
If it comes up by itself after one minute later, the setting is working.
Jan 4, 2014
The performance of Raspberry PI as NAS
I have been running some testing yesterday and made some conclusions.
One of PIs I am running is for file server. An external HDD with NTFS is attached via USB. Ethernet cable is directly connected to the home router. SD card is class 10.
I measured I/O performance with dd command; cf this.
Write speed of SD card is 5MB/s.
Read speed of external HDD with NTFS-3G is 30MB/s, which is surprising.
Write speed of external HDD with NTFS-3G is 5MB/s.
It is interesting that both of them looks similar. I thought that I made some mistake on differentiating HDD from SD card. I am thinking that swap partition thing is limiting the HDD write speed and read speed seems to be limited by the maximum bandwidth that PI can handle.
When I copied a movie file from the file server to Windows 7 PC, the speed is about 50Mbps, which is about 6MB/s. It seems like 6MB/s as NAS is actually excellent compare to other people.
People say the bottleneck as NAS is on CPU due to NTFS-3G being inefficient. While it may be true that NTFS-3G is slow, it doesn't explain why I was getting only 6MB/s while HDD read speed is 30MB/s.
The point is that 30MB/s for HDD reading speed was after NTFS-3G and USB 2.0 bandwidth. Whatever performance of NTFS-3G or USB 2.0 was, I was getting 30MB/s after them.
I think the bottleneck is on the Ethernet port. It is working at 100Mbps not 10Mbps. Theoretically 100Mbps can give me 100Mbps at best, which is about 12MB/s. It means I can never get 30MB/s via wired network. Realistically 100Mbps will give me about half of the speed, which is 6MB/s, which is what I am getting.
For now, 6MB/s is fast enough for movie streaming or any other tasks and it works fine for me. But I think the throughput can be improved if I use USB wireless adapter; probably up to 15MB/s, because the maximum bandwidth, 30MB/s, will be shared by wifi card and HDD.
One of PIs I am running is for file server. An external HDD with NTFS is attached via USB. Ethernet cable is directly connected to the home router. SD card is class 10.
I measured I/O performance with dd command; cf this.
- Write speed: sync; time dd if=/dev/zero of=./test.tmp bs=500K count=1024; time sync
- Read speed: dd if=./test.tmp of=/dev/null bs=500K count=1024
Write speed of SD card is 5MB/s.
Read speed of external HDD with NTFS-3G is 30MB/s, which is surprising.
Write speed of external HDD with NTFS-3G is 5MB/s.
It is interesting that both of them looks similar. I thought that I made some mistake on differentiating HDD from SD card. I am thinking that swap partition thing is limiting the HDD write speed and read speed seems to be limited by the maximum bandwidth that PI can handle.
When I copied a movie file from the file server to Windows 7 PC, the speed is about 50Mbps, which is about 6MB/s. It seems like 6MB/s as NAS is actually excellent compare to other people.
People say the bottleneck as NAS is on CPU due to NTFS-3G being inefficient. While it may be true that NTFS-3G is slow, it doesn't explain why I was getting only 6MB/s while HDD read speed is 30MB/s.
The point is that 30MB/s for HDD reading speed was after NTFS-3G and USB 2.0 bandwidth. Whatever performance of NTFS-3G or USB 2.0 was, I was getting 30MB/s after them.
I think the bottleneck is on the Ethernet port. It is working at 100Mbps not 10Mbps. Theoretically 100Mbps can give me 100Mbps at best, which is about 12MB/s. It means I can never get 30MB/s via wired network. Realistically 100Mbps will give me about half of the speed, which is 6MB/s, which is what I am getting.
For now, 6MB/s is fast enough for movie streaming or any other tasks and it works fine for me. But I think the throughput can be improved if I use USB wireless adapter; probably up to 15MB/s, because the maximum bandwidth, 30MB/s, will be shared by wifi card and HDD.
Raspberry PI overclocking failed. lol
Yesterday I tried overclocking Raspberry PI and the SD card was busted. lol. I properly rebooted the system and the file system was broken. It seems like overclocking and SD card doesn't go along well.
Also I installed "mini DLNA" and NFS, Network File System, for movie streaming. They works very well. I don't know exactly why but I am super exited about having my own NFS server; probably because I dreamed of having one at home since college. lol. It seems like people report that NFS works faster than Samba in terms of network performance.
Also I installed "mini DLNA" and NFS, Network File System, for movie streaming. They works very well. I don't know exactly why but I am super exited about having my own NFS server; probably because I dreamed of having one at home since college. lol. It seems like people report that NFS works faster than Samba in terms of network performance.
Subscribe to:
Posts (Atom)