Notes from the VirtualBox – Part 4

Configuring Ubuntu 18 Server

The single most critical bit of advice about configuring VBox and Ubuntu 18 server is to create the second network adapter in VBox BEFORE you install Ubuntu. If you install Ubuntu server and then create the second VBox network adapter, it takes a lot of screwing around to be able to communicate with it. And overall it doesn’t work as well as when it is configured from the beginning to use a second network adapter. It’s easier to just delete that VBox instance and reinstall than it is to make all the required changes.

That said, let’s get started.

Configuring VBox and Installing Ubuntu 18 Server 

Follow the instructions given in Part 1 and Part 2 of this series to set up a new VM for Ubuntu 18 server and installing it. The biggest difference in installing Ubuntu 18 server and Ubuntu 18 desktop is that you need to select the server .iso image at installation time. The server install process is not as pretty because it is text based but it’s still pretty much the same stuff. If you have installed Ubuntu desktop you should be able to install Ubuntu server.

TIP: One thing I found is that if you start the install process and then cancel it, the next time you try to start that VM it will NOT restart the install process. Instead, it will try to boot off the VM virtual disk and then will halt and ask for a bootable disk. Instead of trying to fix that VM, it’s easier to just right-click on the VM’s name (in the left-hand panel of VBox Manager) and remove it. You can then create a new VM configured as required, click the Start button, and then start the installation process again.

When it has finished the server installation, it requires a reboot. It will ask you to remove the install medium – you can just hit enter since there is no medium to install.

The first time it boots up it will probably stop for 2 minutes or so with a message that includes “Wait for Network to be Configured”. This message is caused by Ubuntu expecting an actual physical device to respond at the dhcp-assigned address of the second (virtual) network adapter. Fortunately, you can specify that the second network adapter is optional and the delay will be eliminated (described below). Less usefully, you can also just remove the VBox-defined second network adapter (Host-Only) to make the wait and the message go away.

Connecting to Ubuntu 18 Server

Starting with Ubuntu 17, the network setup has been handled with NetPlan which uses a “renderer” to configure the network. In Ubuntu 18 desktop the renderer is NetworkManager, a slick tool that automatically manages the network configuration. In Ubuntu 18 server, the renderer is networkd which configures the network using the settings specified in a configuration file in /etc/netplan (50-cloud-init.yaml for servers and 01-network-manager-all.yaml for desktops).

First, let’s see how the network adapters are setup by default. Display info about your network adapters using the ip command as shown below:

sudo ip address show
Default settings for two network adapters

All three devices are named automatically. Device 1 is named “lo” for loopback and this one is always provided. Device 2 is named enp0s3 and this is the NAT network adapter – this is the device that talks to the internet. Device 3 is named enp0s8 and this is the Host-Only network adapter – this is the device that can communicate with other systems in your computer, either the host machine or one or some of the other guest machines.

The configuration file that produced this setup can be viewed as follows:

sudo nano /etc/netplan/50-cloud-init.yaml
Default server netplan file

Note that both addresses are automatically assigned using dhcp. The NAT device always gets 10.0.2.15/24 but the Host-Only devices receives 192.168.56.101/24, except that the 101 gets incrementally higher with each restart (so .101, .102, .103, etc.). Which means that if you want to set up Filezilla or putty or your browser to communicate with your VBox server, you will always have to check what your server’s address is before you try to connect to the server.

Fortunately, it’s easy to set up your server so the Host-only network adapter is assigned a static address. The following screenshot shows the changes that need to be made.

Modified Network Adapter Configuration File

A new second line has been added that specifies that the renderer is networkd. This ensures that the configuration file is used to setup the network adapters.

The enp0s8 device (the Host-Only network adapter) has two lines modified and four lines added. The first modification changes the first addresses entry to specify the desired static ip address; I chose 222 because it was unlikely to get mixed in with any dynamically assigned ip addresses that started with 101. The second modification changes the dhcp4 line to no (it used to say true.

The gateway4, nameservers, and second addresses lines were just copied from other examples on the internet. The most important line is the optional: true line. This is what will prevent your boot process from waiting for two minutes for the static ip address to respond.

When the changes have all been made, save the file and exit. Then execute the following command:

sudo netplan apply
The Host-Only Network Adapter is Now Assigned to 192.168.56.222

The default configuration of the Ubuntu 18 servers should have openssh installed automatically. Let’s check:

sudo ufw enable
sudo ufw status
sudo ufw app list

If the Uncomplicated FireWall (ufw) has already been enabled, it will ask if you want to duplicate it; if so, cancel the enable command. The ufw status command will probably respond that it is active. The command ufw app list will show all of the applications installed that could be process thru the firewall; mine only shows OpenSSH. If your server does not list OpenSSH, refer to Part 3 for instructions on installing OpenSSH. Once OpenSSH is available on your server:

sudo ufw allow openssh
sudo ufw status
Allowing OpenSSH thru ufw and Its New Status

It also would have been possible to allow port 22 instead of allowing OpenSSH but I believe the advantage of specifying the software instead of the port number is that if I wanted to SSH into my machine on a non-standard port (such as 5336), I could configure OpenSSH accordingly and the firewall would automatically adjust (although a reboot might be required). If I specified the exact port number, I would have to specify the exact port number in ufw; no problem there but then I’d have to decide if other applications might use port 22 and if I wasn’t certain, I’d probably leave port 22 open, which is less than ideal because it would leave an extra surface available to be attacked.

To complete the communications setup, the Ubuntu server needs to have Apache (or the web server of your choice) installed. Refer to the instructions in Part 3 of this series or other instructions available on the internet for help installing a web server.

Once you have your web server installed, be sure to issue the following command:

sudo ufw allow apache2
sudo ufw status

Your web server should now be available inside the VBox.

Notes from the VirtualBox – Part 3

Connecting to the New VBox Ubuntu 18 Desktop

Now that we have a shiny new installation of Ubuntu 18 desktop running inside a VBox, it’s time to open up some connections to it. For example, I want to be able to access my VBox Ubuntu from Windows using SSH. I also want to be able to view web pages that are being served by Apache running on my VBox Ubuntu. These are typical of the activities that you would need to be able to perform if you were responsible for maintaining a web site that was hosted by a commercial provider, such as GoDaddy or A2Hosting.

Starting with Ubuntu 17, netplan or NetworkManager became the default method for managing all network adapters. NetworkManager is the default tool (renderer) used with Ubuntu desktop, while networkd became the default renderer for Ubuntu server. This is important because a significant amount of obsolete instructions is still posted on the internet. This blog will only discuss NetworkManager; networkd will be discussed in the upcoming blog about Ubuntu 18 server running in VBox.

Fortunately, NetworkManager is very friendly and just handles it all for you. If you configured your VBox VM to have two network adapters (NAT and Host-only) before installing Ubuntu, those adapters will have addresses assigned to them automatically by NetworkManager.

The easiest way to verify that your network adapters have been assigned addresses is to open a terminal window and then type this command

sudo ip address show

A screen similar to the following will be displayed:

Results of running the ip command

Note that device 2 is named enp0s3. This name is generated by the system based on some special magic formula that superseded the old-style names such as eth0, eth1, etc. enp0s3 is the default connection for the NAT adapter that provides connectivity to the outside world.

Device 3 is named enp0s8 and is also automatically generated for us. It is automatically assigned an IP4 address, typically 192.168.56.xxx for Host-Only network adapters. If your system doesn’t have a third device or if the device doesn’t have an ip address, exit your Ubuntu instance and inside VBox manager add a network adapter (typically Host-Only). When you get back into your Ubuntu instance and repeat the ip command it should show device 3 with an ip address.

NetworkManager in the latest versions of Ubuntu desktop is a slick piece of code but I’m not sure how it’s configured. The configuration file in /etc/netplan only specifies the renderer (NetworkManager); apparently all other details are left to NetworkManager unlike Ubuntu 18 server that requires all network adapter details be specified completely. More in the next blog.

Now that we have two adapters, if we try to access either a web page or an SSH connection from Window we will get failures because the default Ubuntu 18 desktop install doesn’t include the tools to respond to http requests or ssh requests.

So back to our terminal window. Type the following command:

sudo ufw status

If the Uncomplicated Firewall (ufw) is not installed, install it as follows:

sudo apt install ufw

If ufw responds that it is inactive, enable it as follows:

sudo ufw enable

You can repeat the ufw status command at this point and it should tell you that it is active and which ports are available (which should be none).  Now find out which applications have been configure to communicate with the outside world as follows:

sudo ufw app list

Typically, there will be no apps listed or just CUPS (Common Unix Printing System).

Install and Activate OpenSSH

Let’s setup OpenSSH to be allowed thru the firewall first.

sudo ufw allow OpenSSH

If it doesn’t know anything about OpenSSH, it hasn’t been installed. Install the OpenSSH server as follows:

sudo apt install openssh-server
sudo systemctl status ssh

The OpenSSH application should now be listed as enabled and active, similar to the following:

We installed OpenSSH but the service is referred to as ssh

Update the firewall as follows:

sudo ufw allow ssh      or/both
sudo ufw allow OpenSSH

If you do both commands there will be two rules for SSH, as shown when the    sudo ufw status  command is executed.

Both ssh and OpenSSH are available on port 22

Now on Windows, open putty and point it at your VBox Ubuntu:

Note the IP address is the same as the enp0s8 IP address

Click the Open button to start connecting to your VBox Ubuntu. It may complain about not recognizing your VBox Ubuntu but since we are forced to be on (inside) this computer, it is safe to continue. Log in with your user name and password and you’ll be able access your VBox Ubuntu from Windows and perform any terminal operations that you could inside VBox Ubuntu terminal window.

Install and Activate Apache Web Server

Apache web server is the most popular web server in the world and has proven to be robust and stable for many years. It is not automatically installed when you installed Ubuntu 18 desktop into VBox. It can be installed as follows:

sudo apt install apache2
sudo service apache2 start

Now, if we run the command   “sudo systemctl” we will find it running:

Apache is running (3rd line from bottom)

Now we need to make sure Apache can get thru the firewall, so:

sudo ufw allow http       OR/BOTH
sudo ufw allow Apache

Check the firewall status as follows:

sudo ufw status

And the displayed info should be similar to the following:

Now if we go to our Windows browser of choice and put in the IP address given for enp0s8 then we should get a screen similar to the following:

Notes from the VirtualBox – Part 2

Setting up Ubuntu 18 in VBox

Now that we have created a “placeholder” for Ubuntu in the VBox Manager, we can get started installing Ubuntu 18 Desktop. We won’t go step by step thru the installation process because there are many guides available that will walk users thru a new Ubuntu installation.

Instead, we’ll focus on a couple of sticking points that I ran into (and lost many hours trying to resolve them).

BEFORE starting your new VBox Ubuntu instance, set it up as follows:

  • Configure the amount of RAM this instance will use
  • Configure the number of CPU’s it will use
  • Configure the number of network adapters it will use

Display Details in VBox Manager

Show the details about the currently selected VM in the main panel by:

  • Clicking on the Details box in the center of the Welcome screen 
  • Clicking on the Machine Tools dropdown arrow and then selecting Details

The VBox Manager will change to info about each of its major subsystems (shown below):

Configure the Amount of RAM

The System info box shows that this instance of Ubuntu has been configured with 2 GB of Base Memory. Since I have 12 GB installed on my system, I can afford to allocate 4 GB total to this instance. And experience has shown that it will perform a little better and will be less likely to use the swap disk.

To change memory, click on the word “System” in the System info box to display the System tab of the Settings dialog box (shown below).

Drag the control to the right to increase Base Memory to the desired size or left to decrease Base Memory. Click OK button when the desired size has been selected.

Configure the Number of CPU’s (Processors)

The Create New Virtual Machine scripts defaults to one CPU, no exceptions. If your computer has more than one CPU or CPU Core, it will benefit from increasing the number of CPU’s allocated to your VM. My computer runs an Intel i7 processor with 4 cores (or 8 hyperthreads); experience has shown that allocating up to half of these hyperthreads to the VM works fine.

To change the number of CPU’s,  click on the word “System” in the System info box to display the System tab of the Settings dialog box (shown below).

Drag the control to the right to increase the number of CPU’s allocated to this VM. Click the OK button when the desired number has been selected. NOTE that this step could also been performed when changing Base Memory setting previously.

Configure Number of Network Ports

The default setup has one virtual network adapter configured that will reach the internet using NAT (Network Address Translation). If you just want to run a browser then you can skip the rest of this step. However, if you think you might want to run a web server inside your VBox, you will need to set up a second virtual network adapter.

Many VBox instructions available on the internet apply to earlier configurations. In VBox 5.2.19 and later, do the following:

  • Click on the File Menu and then select Preferences. In the dialog box, click on the Network option. If a NatNetwork option is NOT active, click the green plus-sign icon to add and activate it and then click the OK button.
  • Click on the word Network in the Network info box to display the Network tab in the Settings dialog box.
  • Click on the Adapter 2 tab and tick the Enable Network Adapter checkbox.
  • Click on the Attached to: dropdown selector and chose the Host-only Adapter option.  This allows any OS on your computer to “see” this adapter. 
  • When the Network settings look like the following image, click the OK button.

Making these changes before installing Ubuntu improves the quality of the installation, especially when installing the Ubuntu 18 server. The desktop version is friendlier and does a few more things for you but the server version puts all options under your control and won’t do anything unless you specifically instruct it to do something (with great power goes great responsibility). 

Installing Ubuntu

After all of the above, we are ready to install Ubuntu.

  • Click the Start icon (green arrow pointing right). The first time you start your VM, it will detect that it doesn’t have a bootable OS installed on its virtual hard disk so it begins the installation process.
  • In the “Select start-up disk” dialog box, change the Host Drive (virtual hard disk defined earlier, on left) by clicking on the folder icon and then navigating to your Ubuntu download and selecting it, as shown on the right.

Click the Start button and the standard Ubuntu installation process will begin. And like any standard Ubuntu installation, there will be a test of your faith, when it asks if you want to erase the hard drive and lose all your data. It is referring to the virtual hard disk and not your real physical hard disk. 

When done, it will display “Installation is complete. You need to restart the computer in order to use the new installation.” Click the Restart Now button. 

A message will display, “Please remove the installation medium, and then press ENTER”. Since there is no medium to remove, just press ENTER.

Your vbox will grind away for a while and then the familiar user log in screen will display. 

Part 3 of this series will discuss installing the Linux server and some of the problems that may be encountered installing and configuring the server.

Notes from the VirtualBox – Part 1

Setting Up VBox

VirtualBox (VBox) is Oracle Corporation’s entry into the Virtual Machine market. And since it is a free software product, I decided to download it and install it. And I am pleased to announce that it is simple to download and install on Windows 10 (Linux & Mac versions are also available). But without easy access to a VBox guru, getting it configured was a little trickier.

I had tried numerous times to set up my desktop and laptops to dual-boot into either Windows or Linux but without success. Between overly-zealous boot sector protection,  UEFI vs BIOS, and disappearing grub, the best I’d been able to accomplish was selecting either UEFI or BIOS to enable the desired operating system. To change from the currently selected OS to the other OS required a hard reboot, pressing F2 key repeatedly to activate the BIOS setup screens, selecting either the UEFI or BIOS method, and then rebooting again. Needless to say, a slow and clumsy process.

Fortunately, VBox has fixed this problem for me. Now, after booting Win10, I can launch one or more guest machines inside my VBox and have access to any one of them. They are all live and running simultaneously; I can click on the desired OS (window) and use the resources available in that OS as easily as using multiple apps side by side in Windows. This is a big improvement over my attempts to dual boot.

Important Concepts

VBox is based on the concept of host machine and guest machine(s). The host machine is the base computer’s operating system, or Windows 10 in my case. The guest machine is the operating system that runs inside of VBox, or Ubuntu gnu/linux for me.

Installation of VirtualBox

Once the VituralBox installer has been downloaded, just execute it and then follow the prompts. The Win10 installer is smooth and fast and simple. I haven’t tried the other installers, so I can’t guarantee that they will work as easily. The installation routine also doesn’t require any hard decisions, such as disk partitions or CPU cores because those decisions are all associated with the guest machines that you install.

Installation of Guest Machines

Start the VBox Manager and a screen similar to the following should appear. The empty white panel on the left of the screen is where the guest machines will be listed after you have created them. Click the blue New button to create a new virtual machine.

The Create Virtual Machine dialog box appears (on left). As you start to name your new VM, it will try to guess what type of OS you are installing (on right). 

Default New VM with Blank Name
Guesses Your New VM Based on Name

I have already downloaded the .iso image for Ubuntu 18.04 desktop so I will name the new VM “ubuntu 18” – it is just a name so VBox doesn’t care if I name it “third door on the left” or “Bert”. Since I will also be installing Ubuntu 18 server later, I probably don’t want to get too “creative”.

Next it will ask how much memory you want to allocate to this new VM. I have 12 GB of RAM available but its default setting is 1 GB (on left). Even though it is easy to change this setting at any time, I will change it to 2 GB for initial set up (on right).

Next it will ask about the virtual hard disk to add. The first option doesn’t add a virtual hard drive which may be useful for some special situations but none come to mind. The second option is probably the most used option as it provides a place where you can install a new OS. The third option allows you to re-use or share an existing virtual hard drive between various VMs, which seems like it would be useful if you wanted to performance test different configurations using a common software base or if you wanted to reuse the installed software and data but wanted to reinstall the OS. 

I usually create a new virtual hard disk (2nd option). The default size is 10 GB but you don’t actually set the size on this dialog – that will happen in a few steps. And I usually select the first option for the Hard disk file type.

For Storage on physical hard disk (left), I normally select the Dynamically allocated hard disk file; so far the performance has been more than adequate. And finally we can set the size of the virtual hard disk (right). I normally set it to 20 GB.

And in a flash, you are returned to the VBox Manager with the new VM shown on the left. It happens so quickly because the allocated virtual hard disk was not formatted and Ubuntu was not actually installed. Instead, space has been reserved for Ubuntu, nothing more.

New Ubuntu Desktop VM added to Panel on Left

The next part in this series will discuss the installing and configuring Ubuntu 18 desktop and Ubuntu 18 server.

ConcX version 2.3 Is Released

I am happy to announce that ConcX version 2.3 is available for download now. This latest release includes a bunch of reliability, maintainability, and usability improvements. It is now easier to move around on the main screen; the tab now advances to the more important fields so its easier to set up new birds. The orphan bird tab on screen when a flock is loaded has now been eliminated too.

This latest release also includes a new scenario, the Barbershop, where customers come in and wait for a haircut and one or more barbers call the customer waiting the longest and give them a haircut. And the shop manager makes sure that customers pay and keep track of everything else.

Once again, just download the ConcX zipfile and copy it into any directory that appeals to you. Unzip/gunzip it in that directory and then move into the ConcX subdirectory and then run it. That’s right. No need to go hunting for the appropriate jar files and moving them into a lib folder – that’s all handled when you unzip the file. And when it starts, it automatically makes a config file based on where you install it. So it all should just start working. In Windows, you can just double-click on the jar file and it all should start running. Unfortunately, Ubuntu Linux won’t let you do this because of its protection scheme.

However, open a terminal window (Linux) or a cmd window (Windows) in the folder that you unzipped ConcX into and issue this command:

java -jar concx.jar

and it all should just start running. True confession: I like running ConcX best from the terminal window of Ubuntu because of its snappy performance. Loading flocks from a file seem almost instantaneous. It’s easily 10 times faster than loading the same flocks in Windows.

 

The Javadocs have all been updated and are available for download.

The Getting Started with Avian Computing guide has also been updated and is also available for download.

There are lots more little improvements in ConcX v2.3 that make life better in the parallel world. Go ahead and download this latest version and give it a try.

 

ConcX 2.2 Released

I am pleased to announce version 2.2 of ConcX has been released today, 2/2. I like that: V2.2 released on 2/2. And it’s Groundhogs Day – even better. Anyway, it has many usability improvements, with the net result being that ConcX is much easier to setup and run from either Linux or Window.

The big news is that now you can download the ConcX zipfile and copy it into any directory that appeals to you. Unzip it in that directory and then move into the ConcX subdirectory and then run it. That’s right. No need to go hunting for the appropriate jar files and moving them into a lib folder – that’s all handled when you unzip the file. And when it starts, it automatically makes a config file based on where you install it. So it all should just start working. In Windows, you can just double-click on the jar file and it all should start running. Unfortunately, Ubuntu Linux won’t let you do this because of its protection scheme.

However, open a terminal window (Linux) or a cmd window (Windows) in the folder that you unzipped ConcX into and issue this command:

java -jar concx.jar

and it all should just start running. True confession: I like running ConcX best from the terminal window of Ubuntu because of it’s snappy performance. Loading flocks from a file seem almost instantaneous. It’s easily 10 or 20 times faster than loading the same flocks in Windows.

Version 2.2 has many other improvements. The main display window of ConcX has been resized so it will all display on a laptop with a 1366 x 768 maximum resolution. It was frustrating to see the bulk of the screen but not be able to access the Start All button at the bottom of the screen.

The Bird Type field and all of the Food Pod fields have been changed to search for any birds or foods that start with the text you entered. If it finds more than one match, a dialog box is popped up and all matching names are listed. For example, if you enter “add” and then tab out of the Bird Type field, the dialog that pops up will list Add1Bird, Add2Bird, Add3Bird, Add4Bird, and Add5Bird for you to select. This validation method works the same in either Jar mode or IDE mode.

The button to the right of the Bird Type and Food Pod Type fields is no longer used to select the Bird or Food. Instead it gives users access to Birds and Food Pods outside of the jar file. Because the jar file is generated from source code, if a user didn’t download the source code, there was no way to increase the number of Birds or Foods – they were stuck with whatever choices were included at compile time. The buttons give users access to Birds or Foods that are compiled outside the jar file, allowing (for example) a developer to generate the Bird.class files or Food.class files and let multiple jar users to access these new files.

The Javadocs have all been updated and are available for download.

The Getting Started with Avian Computing guide is being updated and should be ready in a few days. It will be posted on this web site as soon as it is ready.

There are lots more little improvements in ConcX v2.2 that make life better in the parallel world. Go ahead and download this latest version and give it a try.

 

First KiloCore Chip Announced

Congratulations to the researchers at the University of California – Davis for their development of the world’s first chip with 1,000 independently programmed processing cores. The research team was lead by Bevan Baas, professor of electrical and computer engineering and included  Aaron Stillmaker, Jon Pimentel, Timothy Andreas, Bin Liu, Anh Tran and Emmanuel Adeagbo, all graduate students at UC Davis. More information about their impressive achievement is available here. For you spec junkies, be sure to read their detailed paper here.

Dubbed the KiloCore chip, it boasts a number of impressive capabilities beyond just the number of cores:

  • It is implemented in 32nm CMOS technology
  • It operates at 1.78 GHz max at 1.1 V
  • It dissipates only 0.7 mW @ 0.56V @ 115 MHz per processor for a total of 1.3 W
  • At 0.84 V, the 1000 cores execute 1 trillion instructions per second while dissipating just 13.1 Watt
  • Each processor contains 575,000 transistors
  • The complete chip contains a total of 621 million transistor (less that half the 1.4 billion transistors in an Intel i7 quad core CPU)
  • Each processor is independently clocked
  • Each processor can shut itself down to save energy when not needed
  • Each processor can run its own small program instead of SIMD

As impressive as its specs are, what impresses me the most is how soon it arrived. I expected that various groups developing multi-core units would sneak up on the 1,000 core mark more slowly, edging each other on a few tens of cores or maybe one hundred cores at a time. Instead the UC Davis team leapfrogged the other teams and included 3 to 4 times more cores than the few other chips with more than 100 cores. Of the 60-plus multi-core chips listed in their research, most have fewer than 60 cores and only 3 or 4 have more than 100 cores.

Color me impressed. And when can I get one.

And Another Dream Dies (or at least goes to sleep)

Well, I had great dreams for expanding Avian Computing into using Nvidia CUDA to put all those lovely GPU’s to work in parallel but that just isn’t going to work. Or, more accurately, it’s going to take a lot more work than I can afford to devote to the project at this time.

See, there is a Java product called JCUDA that provides Java functionality to CUDA-enabled Nvidia cards. Unfortunately, what that means is that the Java performs JNI calls to the c/c++ libraries that are a thin layer over the built-in GPU math functions. So if I want to do shader functions or polygon transforms or FFT operations, that’s easy. However, if you want to do Java, just a plain old “hello world” program, that’s another story. At least I think it is.

And there’s the rub. Or a couple of them. There’s an Eclipse IDE version designed for CUDA/JCUDA but that version runs on Linux. And the “simplified” install notes run a number of pages and it took until page 3 of cryptic instructions just to run a test that your Linux system is correctly configured. I mean, I do Linux haltingly and hesitantly, so that would be a long road to probable failure.

Or there’s a Windows version but that’s configured to run in Visual Studio. Which means downloading, installing, and learning Visual Studio and then installing CUDA and getting it configured. Again, another long road to probable failure.

Oh, and then there’s learning CUDA itself. Learning all the directives, all the hints to insert into the c code to suggest to the compiler where to insert parallelism, bla-bla-bla.

At the rate that I can find free time, I suspect that it would take about a year to dedicate enough time to become sufficiently capable with CUDA/JCUDA to know if I can apply it to Avian Computing.And unfortunately, there are way too many other promising fields to investigate to be able to make that kind of commitment.

Hear that sad whistling sound? That’s the sound of the wind going out of that particular sail. But better I figure it out now than 6 months from now.

ConcX v2.1 Now Available for Download

I am pleased to announce that the Concurrency Explorer (ConcX) version 2.1 source code is now available for free download. The source code is written in Java 8 and expects to be run from NetBeans IDE, both of which are also available for free download from Oracle. It should be cross-platform compatible for Windows, Linux (lightly tested) and Mac (not yet tested). See the Sidebar for the download link.

Also available is the new “Getting Started with Avian Computing” guide which describes the basics of Avian Computing and introduces ConcX, how to install it and run it from NetBeans, and the controls and indicators used in ConcX. The Getting Started guide also includes about a dozen examples of parallel scenarios that can be loaded and run and (even better) experimented with, adjusting the configurations of the birds in each scenario to see if it affects how the program runs. See the Sidebar for the download link.

Simulating Greed Results – Part 1

So the first round of simulations have been finished and the results have been very interesting. On the one hand, the results are pretty much what you’d expect; greed by one entity affects the entities closest to the greedy one. On the other hand, because this simulation makes it possible to monitor total throughput, it allows us to quantify and measure the impact of greed on the complete system. In other words, this simulation can be thought of as a way to study the impact of greed on the GDP of the system.

In the first round of testing, every farmer tries to turn on the water no more than 3 times a second. The nap() method in BasicBirds get a random value between 10ms and the nap length value for each bird after each time the bird has eaten. This means that “lucky” birds will attempt to turn on the water more frequently because the Java random number generator produced lower nap numbers. Unlucky birds will attempt to turn on the water less frequently, again because the Java random function generated higher nap numbers.

Luckiness also manifests itself in another way. Because each farmer (bird) must successfully get two shared resources, a farmer must be lucky enough to try to turn on the water when neighboring farmers aren’t already using the water. Sometimes trying more frequently just means failing more frequently. In general, however, trying more frequently results in water being turned on more frequently.

So in the first round of testing with all the farmers set up the same way, all of the farmers had pretty similar results. Some failed more than others, some succeeded more than others, but it was always different farmers in each run who succeeded or who failed. The consistent variability of the results provides assurance that ConcX isn’t favoring one farmer over another and biasing the outcomes. Click on the charts below to see the full charts.

TotalFails300all

Total Failed Attempts and Successful Attempts

TotalDeliv300all

Total Amount of Water Delivered by Run

TotalDiff300all

Difference Between Farmers Receiving Most and Receiving Least

 

 

 

 

 

 

AmtDeliv300AllRun1

Run 1 – Ajia1 Received Most Water

AmtDeliv300AllRun2

Run 2 – Dave1 Received Most Water

AmtDeliv300AllRun3

Run 3 – Irma1 Received Most Water

 

 

 

 

 

 

The actual numbers reported in these runs are unimportant. With this first round (3 runs) what’s important is that most of the farmers are receiving similar amounts of water and the differences attributable to luck or chance. This round establishes the baseline that will be used for comparison to later rounds of testing.

In the next round of testing, one of the farmers is changed to try to turn on 3 times more frequently than the other farmers. Which farmer is selected is completely arbitrary; any of the 10 farmers could have been selected and similar results would have been achieved. In these results, Bill1 was selected to be greedy and try more frequently to get water.

The following results show that the number of failed attempts has gone up slightly even though the total number of successful attempts is almost unchanged. The total water delivered is also almost unchanged; it goes up slightly. The biggest change is seen in the Difference chart (Farmers: Max Deliv vs Min Deliv). The Max amount that any one farmer received (Bill1) has gone up while the least amount that any one farmer received (Ajia1 or Cate1) has gone done. Again, be sure to click on the thumbnails below to see the details.

TotalFails100For1

Successes & Failures – 1 Slightly Greedy Farmer

TotalDeliv100For1

Total Water Delivered – 1 Slightly Greedy Farmer

TotalDiff100For1

Differences – 1 Slightly Greedy Farmer

 

 

 

 

 

AmtDeliv100Run1

Bill1 is Greedy Farmer – Ajia1 and Cate1 Suffer – Run 1

AmtDeliv100Run2

Bill1 is Greedy Farmer – Ajia1 and Cate1 Suffer – Run 2

AmtDeliv100Run3

Bill1 is Greedy Farmer – Ajia1 and Cate1 Suffer – Run 3

 

 

 

 

 

 

In the next round of testing (3 runs), the greedy farmer becomes even greedier and tries to turn on the water 10 times more frequently than the neighboring farmers. Again, the farmer that was selected was completely arbitrary.

TotalFails30For1

Total Failures & Successes – 1 Greedy Farmer

TotalDeliv30For1

Total Amount Delivered – 1 Greedy Farmer

TotalDiff30For1

Differences Max & Min – 1 Greedy Farmer

 

 

 

AmtDeliv30Run1

Run 1 – Edna1 is Greedy Farmer – Dave1 and Fred1 Suffer

AmtDeliv30Run2

Run 2 – Edna1 is Greedy Farmer – Dave1 and Fred1 Suffer

AmtDeliv30Run3

Run 3 – Edna1 is the Greedy Farmer – Dave1 and Fred1 Suffer

 

 

 

 

 

 

 

 

The results of this round of testing are similar to the previous run; the total number of failed attempts have gone up while the total number of successful attempts is about the same. The total amount of water delivered is moving slightly higher. However, the difference between the maximum amount delivered to a farmer (Edna1) has gone significantly from before while the amount of water delivered to the least fortunate farmers (her neighbors Dave1 and Fred1) has dropped significantly.

One lesson that could be taken from these three rounds of testing is that the total amount of water delivered to the whole system doesn’t go up significantly by allowing one farmer to be more greedy. In this example, the gains of one greedy farmer is greater than the losses of the neighboring farmers. The biggest difference from one test to another has been in the “inequality” in the distribution of water; the additional water that the greedy farmer gained has come at the expense of the neighbors.

It is tempting to draw conclusions from these results, that in societies where there are limitations to resources (every society on earth) that the greediness of an individual is frowned upon because it doesn’t significantly increase the overall amount of product while increasing the hardship of others.

But is this always the case? What happens if death is introduced into the system? Followers of Avian Computing know that birds dying from lack of food has been part of the system design from the beginning. In the next rounds of testing, farmers who receive insufficient water are allowed to give up and move away because their crops died because of lack of water. While this seems cruel, it is in keeping with standard economic theory, where producers with a “competitive advantage” succeed while less efficient producers are allowed (or encouraged) to give up making their current product and begin making a new product.

Stay tuned for the next results.