Friday, December 30, 2016

Quick Python notes

In python shell, use execfile('foo.py') to execute directly in the shell. Mostly trivia, not a good way to do things but don't want to look this up again if it comes up.

Thursday, December 29, 2016

Tensorflow installation on ubuntu linux hints

tensorflow 'Download and Setup' instructions seem to be great (verified for only installing the CPU version).

minor clarification: When reading the installation instructions you can disregard the part that says 'install tensorflow' if the command pip install tensorflow worked for you. no indentation on that page makes it a tiny bit ambiguous in the section 'Pip installation' on page: https://www.tensorflow.org/get_started/os_setup#test_the_tensorflow_installation


Ubuntu hints

notes about ubuntu install for a NUC:

created a bootable USB with these instructions:
https://www.ubuntu.com/download/desktop/create-a-usb-stick-on-windows

in particular the rufus tool was key to making this painless.


must also do:
https://help.ubuntu.com/lts/serverguide/apt.html

sudo apt update
sudo apt upgrade

or the 'ubuntu software' tools won't work/broke when i tried to install emacs.

creating a shared drive with windows host:
with virtual mx shut down, go to 'edit virtual machine settings', select vmware options tab, select drive to share and name it
the drive will appear under /mnt/hgfx/ when you turn virtual machine back on


Saturday, December 24, 2016

Ubuntu in VMWare display issue?

only coming up in 800x600 or VGA? suspend the client, then resume it. seems to resolve issue for me. will update if i find this incorrect.

resizing the windows window also seemed to work.



Thursday, December 22, 2016

Where are Linux OpenCL SDKs installed?

you were wondering that too?

they are in the /opt directory:
cd /opt/intel/
cd /opt/AMDAPPSDK-3.0/

basic command line (confirmed to compile, not execute):
gcc -L/opt/intel/intel-opencl-1.2-6.3.0.1904/opencl-1.2-sdk-6.3.0.1904/lib64 -o target 1.c -lOpenCL


Tuesday, December 06, 2016

dispatch table with function pointers in C simple sample

#include "stdio.h"
#include "string.h"

void foo() {
printf("in foo\n");
}
void bar() {
printf("in bar\n");
}
void foo2() {
printf("in foo2\n");
}
struct table_entry_s { char *name; void(*function)(); };

typedef struct table_entry_s table_t;

//populate the table
table_t dispatchTable[256] =
{ {"foo", foo}, {"bar", bar}, {"foo2", foo2}, {NULL, NULL} };

#define NUM_ENTRIES 3

void dispatchKernel(char *string)
{
int iFound = 0;

printf("dispatchKernel with %s\n", string);

for (int i = 0; i < NUM_ENTRIES; i++)
{
char *result = NULL;
result = strstr(string, dispatchTable[i].name);
if (result == NULL)
{
printf("%s was not in %s\n", dispatchTable[i].name, string);
}
else
{
iFound = 1;
printf("Found %s in %s\n", dispatchTable[i].name, string);
dispatchTable[i].function();
}
}
}

void main()
{
printf("hello\n");

printf("dispatchTable[0] name = %s\n", dispatchTable[0].name);
printf("dispatchTable[1] name = %s\n", dispatchTable[1].name);
printf("dispatchTable[2] name = %s\n", dispatchTable[2].name);

dispatchTable[0].function();
dispatchTable[1].function();
dispatchTable[2].function();

dispatchKernel("fdafsdbarfdsafs");

printf("goodbye\n");

}