From 9462407ba8af4f69cd1d3769b1ca63b36ff98454 Mon Sep 17 00:00:00 2001 From: Ed Braaten Date: Tue, 21 Apr 2015 14:02:59 -0700 Subject: [PATCH] Intial commit of source code samples for GitHub repo. --- COBOL/Makefile | 5 +++ COBOL/hello.cob | 6 +++ README.md | 5 ++- bash/hello.sh | 27 +++++++++++++ openmp-c/Makefile | 38 ++++++++++++++++++ openmp-c/hello-omp | Bin 0 -> 9904 bytes openmp-c/hello-omp.c | 43 +++++++++++++++++++++ openmp-c/versioninfo.txt | 3 ++ perl/hello.pl | 55 ++++++++++++++++++++++++++ python/hello.py | 81 +++++++++++++++++++++++++++++++++++++++ ruby/hello.rb | 45 ++++++++++++++++++++++ sizeofchk/Makefile | 40 +++++++++++++++++++ sizeofchk/README.md | 4 ++ sizeofchk/sizeofchk.c | 46 ++++++++++++++++++++++ 14 files changed, 397 insertions(+), 1 deletion(-) create mode 100644 COBOL/Makefile create mode 100644 COBOL/hello.cob create mode 100755 bash/hello.sh create mode 100644 openmp-c/Makefile create mode 100755 openmp-c/hello-omp create mode 100644 openmp-c/hello-omp.c create mode 100644 openmp-c/versioninfo.txt create mode 100755 perl/hello.pl create mode 100755 python/hello.py create mode 100755 ruby/hello.rb create mode 100644 sizeofchk/Makefile create mode 100644 sizeofchk/README.md create mode 100644 sizeofchk/sizeofchk.c diff --git a/COBOL/Makefile b/COBOL/Makefile new file mode 100644 index 0000000..b990062 --- /dev/null +++ b/COBOL/Makefile @@ -0,0 +1,5 @@ +COBCFLAGS=-free -x + + +hello: hello.cob + cobc ${COBCFLAGS} -o hello hello.cob diff --git a/COBOL/hello.cob b/COBOL/hello.cob new file mode 100644 index 0000000..81c0919 --- /dev/null +++ b/COBOL/hello.cob @@ -0,0 +1,6 @@ +IDENTIFICATION DIVISION. +PROGRAM-ID. HELLO-WORLD. +* simple hello world program +PROCEDURE DIVISION. + DISPLAY 'Hello COBOL world!'. + STOP RUN. diff --git a/README.md b/README.md index 749e5f9..4f92b6a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # src-ed -Soruce code samples for various languages - hello name-your-language world! +Source code samples for various languages - hello name-your-language world! + + + diff --git a/bash/hello.sh b/bash/hello.sh new file mode 100755 index 0000000..0869db8 --- /dev/null +++ b/bash/hello.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# +# Sample Hello World! bash script... +# + +declare -A FRUIT_COLOR + +FRUIT_COLOR=( ["apple"]="red" ["banana"]="yellow") +VERINFO=`git describe --abbrev=7 --dirty --always --tags` + + +# Obligatory Hello World with some version info +echo "Hello Bash World! Version: $VERINFO" + +# Show list of command line arguments +echo "Command line args: $*" + +# Determine number of physical CPU sockets +SOCKETCOUNT=`cat /proc/cpuinfo | grep 'physical id' | sort | uniq | wc -l` +echo "CPU socket count: $SOCKETCOUNT" + +# print out our FRUIT_COLOR associative array (key/value pairs) +declare -A sorted_fruit +for fruit in "${!FRUIT_COLOR[@]}"; do + echo "$fruit = ${FRUIT_COLOR["$fruit"]}"; +done | sort --reverse + diff --git a/openmp-c/Makefile b/openmp-c/Makefile new file mode 100644 index 0000000..3c1031b --- /dev/null +++ b/openmp-c/Makefile @@ -0,0 +1,38 @@ +# Sample makefile to add version/compiler info via an extra +# object module linked to final binary. +# +COMPILER_VER:=$(shell gcc --version) +COMPILER_OPTS=-fopenmp +GIT_DESCRIBE:=$(shell git describe --abbrev=7 --dirty --always --tags --long) + +.PHONY: all +all: hello-omp + +versioninfo.txt: + @echo "@(#) Compiler version: ${COMPILER_VER}." >versioninfo.txt + @echo "@(#) Compiler options: ${COMPILER_OPTS}." >>versioninfo.txt + @echo "@(#) Git info: ${GIT_DESCRIBE}" >>versioninfo.txt + +versioninfo.o: versioninfo.txt + objcopy --input binary \ + --output elf64-x86-64 \ + --binary-architecture i386 \ + --add-section versioninfo=versioninfo.txt \ + --set-section-flags versioninfo=contents,noload \ + versioninfo.txt versioninfo.o + +hello-omp: hello-omp.c Makefile versioninfo.o + gcc $(COMPILER_OPTS) -DVERSIONINFO="\"$(GIT_DESCRIBE)\"" hello-omp.c \ + versioninfo.o -o hello-omp + +.PHONY: test +test: + (export OMP_NUM_THREADS=2; ./hello-omp) + sleep 5 + (export OMP_NUM_THREADS=24; ./hello-omp) + sleep 5 + (export OMP_NUM_THREADS=500; ./hello-omp) + +.PHONY: clean +clean: + rm -f hello-omp versioninfo.* diff --git a/openmp-c/hello-omp b/openmp-c/hello-omp new file mode 100755 index 0000000000000000000000000000000000000000..01c0621cd194f9ce6d9c29b03d3a4c8a76ae472d GIT binary patch literal 9904 zcmb<-^>JfjWMqH=CI&kO5bpt-16T+`GB9|EfVp78fx&`-lfi*OobX^v#$1}uxmBj}^)j8)R78j=$L$qVnoS$0|pPpJ0pPN__Uy@Oj znwV0|029kA&BYLdsEN-j&1G=+_YH_INGwXs$w|$LPt8j~69GF2TD7 z%Z#C*C^N4ljUhfhCo?G->ipcq%sd8nA5SOecq2U{JyVF0hI$6zz+_@zVqj)qfnu-_ z10w??!wm)o22gqhrJGWzOiobA^cy10z{tP^PKzLUkdT9l8VjiO;$Vd6xu5~!GcmA3 z6Y39sNcjLt>zp7BP%I$;5eMZ_P+ouvGbkX5gYpARTmwlQlwV-t21w$_<)8(UILL08 zdIuzNkliqG4M4v%iuqnrv19<2vTSYJ$LU|{fQKEiPrqzi%n zn{MJ%VEC`Pg;RlnU*3V?zbc5I0aEbt!TkN@eAw@3@?`d|Ns9>+60h$ckCBTUYJpLtiKS=8T1Ah4ikk}3o52pU$4`z?fryiY$JPy9H_h7u> zaq&kfQ|#egAcY>SmrB0GdUPIx=zj#&-(YLWrNF>YDj4d~`SeBI|NsAEkFlz8DKId8 zJ`8e?N3(4Nn*swvi5%PsBBA>k_!1aAI-mZ(5c{(F|NsB|@(eGFAvDMskLEW9$6fD$ zZ9VS#qk+?bVS-1u>kp9S{hSUAV3S@<`uG3;z8HZ7hW#tyVs-!i|9{c>@BjbKWBZT6 zMKk{W|L@W3ddH*F^?^sP>jQ{?I*;w|;Ba7gAqA0r;L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GoSy+!zM_f?z~}o=#RVB)i(i6qRx%pk@9D@Rbp#Tnq`1Cj(Yg9HOC-y;b#Ff&Lp9DwF$RB`lL6(Y;b0BQ|F z*f0{5URfAE{)h2lG^j3T1dXOa=Vf8ypz#ML23`gMv~dnS22dM`m%#x|+z~2{J}wdt zE>{rl2e|`eM;cfhGn{*&=D@~TKx#pFCRjaYe1XO)vH9x=SiK~}1!%az%DeMmaR~;{ zz&*%ZX!XKy3u-TDNFF2(8}9(kKZ3#mH1-Y>2aj!n%>d1EVTR`qu$&;n1a8!E2sTF0 z7!daKgU$Uy;D8dsNQcT`b1>7J4pcpCya?o05Vi-a$4qabjG*~kUIx%?4oDrW>`VpE z%SkY7g@zkQ4ul&SvCpf{1&d>*+ZAB*K{`?KF{t^VX&+>nvpCeh#39bg1ad!S`M?bp zM>ZM4md7D(!vva#lwin$*0&JV3=B~?)K@~)qvz8$9O@S{VGp-WObiTyO#BQL&~_rs z-u)nP21NM=Yv-K<+xzi9dOi9YY%ebZXgUsL26#-Jfq~&SSiK~}1GIPqEgTVIz$|as znL*(o$$%a&!pxv>=4AlQ^MT9<;7DotZZ&n$uV_!&TR?0WH_N&d7vJp)v(Awzt;Tacr#YrLzU z3urL`*yk`die)Jb@h*{mj=rAG4Dra$fK2z4fK0!ERyH^|fL1nuwS!^;x=_Kv0eM{lOc&C+2_$Veyaje0ED*q) zcu-`Znj9Ywax&C+Fl&&OVjx))kGk+9KBYK6J|i(N1+*x{(?7nrBqcL1zO* +#include + +#ifdef _OPENMP + +static char versionbuf[16]; +static char gitversion[] = VERSIONINFO; + +int main() +{ + int tcount = 0; + char *versionp; + + /* Tell about the version of OpenMP API we're using. + * Specification source: www.openmp.org. + */ + switch (_OPENMP) { + case 200805: + versionp = "3.0 (May 2008)"; break; + case 201107: + versionp = "3.1 (Jul 2011)"; break; + case 201307: + versionp = "4.0 (Jul 2013)"; break; + default: + sprintf(versionbuf, "(%6.6d)", _OPENMP); + versionp = versionbuf; + break; + } + printf("Using OpenMP version: %s\n", versionp); + printf("Program git commit info: %s\n", gitversion); + printf("Max threads = %d\n", omp_get_max_threads()); + +#pragma omp parallel +#pragma omp atomic + tcount++; + +#pragma omp parallel + /* Hello parallel world... */ + printf("Hello OpenMP World from thread %3.3d of %3.3d! (tcount=%d)\n", + omp_get_thread_num() + 1, omp_get_num_threads(), tcount); +} + +#endif diff --git a/openmp-c/versioninfo.txt b/openmp-c/versioninfo.txt new file mode 100644 index 0000000..432ca87 --- /dev/null +++ b/openmp-c/versioninfo.txt @@ -0,0 +1,3 @@ +@(#) Compiler version: gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-16) Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.. +@(#) Compiler options: -fopenmp. +@(#) Git info: e1e14b8-dirty diff --git a/perl/hello.pl b/perl/hello.pl new file mode 100755 index 0000000..a45cf03 --- /dev/null +++ b/perl/hello.pl @@ -0,0 +1,55 @@ +#!/usr/bin/env perl +# +# Perl language Hello World! (and then some...) +use strict; +use warnings; + +my @animals = ("camel", "llama", "owl"); +my %fruit_color = (apple => "red", banana => "yellow"); +my @fruits = keys %fruit_color; +my @colors = values %fruit_color; +my $verinfo = `git describe --abbrev=7 --dirty --always --tags`; + +# Obligatory Hello World with some version info +print "Hello Perl World! Version: $verinfo\n"; + +# Show list of command line arguments +print "Command line args: @ARGV\n"; +print "ARGV[0] = $ARGV[0]"; +print "ARGV[1] = $ARGV[1]"; +print "ARGV[2] = $ARGV[2]"; + +# print out our animals array in reverse-sorted order +print "\nValue of animals array:\n"; +foreach (reverse @animals) { + print 'item = ' . $_ . "\n"; + if ($_ eq $animals[0]) { + print " Condition is TRUE, \"$_\" eq " . "$animals[0]\n"; + } else { + print " Condition is FALSE, \"$_\" ne " . "$animals[0]\n"; + } +} + +# print our fruit_color hash (key/value pairs) +print "\nValue of fruit_color hash:\n"; +foreach (keys %fruit_color) { + print "$_ = $fruit_color{$_}\n"; +} + +# Let's create the file test.out and write animals array to it... +print "\nWriting test.out file...\n"; +open(my $out, ">", "test.out") or die "Can't create/open test.out! $!\n"; +foreach (@animals) { + print $out "$_\n"; +} +close $out or die "$out: $!\n"; + +# Now open the file we wrote and read it back... +print "\nContents of test.out file:\n"; +open (my $in, "<", "test.out") or die "Can't open test.out! $!\n"; +my $linenum = 1; +while (<$in>) { + print "line $linenum: $_"; + $linenum += 1; +} +close $in or die "$in $!\n"; diff --git a/python/hello.py b/python/hello.py new file mode 100755 index 0000000..0564ab7 --- /dev/null +++ b/python/hello.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python +# +# Sample Hello World! python script... +# + +import subprocess +import sys +import os + +animals = ["camel", "llama", "owl"] +fruit_color = { "apple":"red", "banana":"yellow"} +fruits = fruit_color.keys() +colors = fruit_color.items() +verinfo = subprocess.check_output(["git", "describe", "--abbrev=7", + "--dirty", "--always", "--tags"]) + +# Obligatory Hello World with some version info +print "Hello Python World! Version: " +verinfo + +# Show list of command line arguments +print "Command line args: ", +for i in sys.argv[1:]: + print " " + i, +print "" + +# Determine number of physical CPU sockets +if os.name == 'nt': + pass +else: + socketcount = subprocess.check_output(["bash","-c", + "(cat /proc/cpuinfo | grep 'physical id' | sort | uniq | wc -l)"]) + print "CPU socket count: ", socketcount + +# print out our animals array in reverse-sorted order +print "\nValue of animals array:" +for i in sorted(animals, reverse=True): + print "item = " + i + if (i == animals[0]): + print " Condition is TRUE, \"" +i+ "\" == " + animals[0] + else: + print " Condition is FALSE, \"" +i+ "\" != " + animals[0] + +# print our fruit_color dictionary (key/value pairs) +print "\nValue of fruit_color hash:" +for fruit,color in sorted(fruit_color.items(), reverse=True): + print fruit, " = ", color + +# Read a non-existent environment variable and supply default value... +some_env_var = os.getenv("PROBABLY_NOT_THERE", "Default Value") +print "\nPROBABLY_NOT_THERE is set to '"+some_env_var+"'\n" + +# Let's read in the PATH variable from the OS and print it out... +path_env_var = os.environ['PATH'] +print "OS PATH var is set to: '"+path_env_var+"'\n" + +# Let's manipulate PATH variable and then restore it +print "Adding :/test to PATH variable" +os.environ['PATH'] = os.environ['PATH'] + ":/test" +print "OS PATH var is set to: '"+os.environ['PATH']+"'\n" +print "Restoring original PATH value." +os.environ['PATH'] = path_env_var +print "OS PATH var is set to: '"+path_env_var+"'\n" + + +# Let's create the file test.out and write animals array to it... +print "\nWriting test.out file..." +file = open("test.out", "w") +for i in animals: + file.write(i+"\n") +file.close() + +# Now open the file we wrote and read it back... +print "\nContents of test.out file:" +file = open("test.out", "r") +linenum = 1 +for line in file: + print "line "+str(linenum)+": "+line, + linenum += 1 +file.close() + +sys.exit(0) diff --git a/ruby/hello.rb b/ruby/hello.rb new file mode 100755 index 0000000..3a5d63c --- /dev/null +++ b/ruby/hello.rb @@ -0,0 +1,45 @@ +#!/usr/bin/env ruby +# +# Hello Ruby World! +# + +animals = ["camel", "llama", "owl"] +fruit_color = { "apple" => "red", "banana" => "yellow" } + +verinfo = `git describe --abbrev=7 --dirty --always --tags` + +puts "Hello Ruby World! Version: #{verinfo}" +print "Command line args: " +ARGV.each do |arg| + print "#{arg} " +end +print "\n" + +# print out our animals array reverse sorted... +(animals.reverse).each do |i| + print "item = ", i, "\n" + if i == animals.first + print 'Condition is True, "camel" == ', i, "\n" + else + print 'Condition is False, "camel" != ', i, "\n" + end +end + +# print out our Ruby hash +fruit_color.each do |key, value| + print key, " = ", value, "\n" +end + +# Let's create the file test.out and write animals array to it... +file = File.new("test.out", "w") +animals.each do |i| + file.syswrite("#{i}\n") +end +file.close + +# Now open the file we wrote and read it back... +filelines = IO.readlines("test.out") +filelines.each do |i| + print i +end + diff --git a/sizeofchk/Makefile b/sizeofchk/Makefile new file mode 100644 index 0000000..f7acd45 --- /dev/null +++ b/sizeofchk/Makefile @@ -0,0 +1,40 @@ +# Makefile for Simple Sizeof Utility +# +# Created 2014-06-26 by Ed Braaten +# + +# Variables that may need tweaking... +COMPILER=gcc +#COMPILER=icc +#COMPILER=clang +CCOPTIONS=-O -Wall +INSTALLPATH=/usr/local/bin + +# These variables shouldn't need any tweaking +CCVERSION=`${COMPILER} --version | head -1` +BINARYNAME=sizeofchk-${COMPILER} +SHORT_SHA:=$(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown") +PGM_VERSION=1.0 (git-$(SHORT_SHA)) + + +# Target to build the main program... +${BINARYNAME}: Makefile sizeofchk.c + @echo "#define COMPILEINFO \"${CCVERSION}\"" >sizeofchk.h + @echo "#define ARCHINFO \""`uname -m`"\"" >>sizeofchk.h + @echo "#define SYSINFO \""`uname -s`"\"" >>sizeofchk.h + @echo "#define RELEASEINFO \""`uname -r`"\"" >>sizeofchk.h + @echo "#define VERSION_STRING \"${PGM_VERSION}\"" >>sizeofchk.h + @echo "Header file created..." + ${COMPILER} ${CCOPTIONS} -o ${BINARYNAME} sizeofchk.c + chmod 755 ${BINARYNAME} + +install: + mkdir -p /usr/local/bin + cp ${BINARYNAME} ${INSTALLPATH} + chmod 755 ${INSTALLPATH}/${BINARYNAME} + +clean: + rm -f ${BINARYNAME} sizeofchk.h *.o + +tidy: + rm -f *.o diff --git a/sizeofchk/README.md b/sizeofchk/README.md new file mode 100644 index 0000000..365dc80 --- /dev/null +++ b/sizeofchk/README.md @@ -0,0 +1,4 @@ +sizeofchk +========= + +Utility to print out size in bits of basic types supported by your compiler. diff --git a/sizeofchk/sizeofchk.c b/sizeofchk/sizeofchk.c new file mode 100644 index 0000000..5fcc28b --- /dev/null +++ b/sizeofchk/sizeofchk.c @@ -0,0 +1,46 @@ +/* simple utility to print out sizeof values... +*/ + +#include +#include +#include "sizeofchk.h" /* generated by makefile */ + +static char version[] = VERSION_STRING; + + +int main() +{ + int (*funcptr)(); + + printf("Sizeof Utility by Ed Braaten - Version %s\n", version); + printf("Running on %s (%s %s)\n", ARCHINFO, SYSINFO, RELEASEINFO); + printf("Compiler version: '%s'\n\n", COMPILEINFO); + + printf(" sizeof(char) = %lu bits\n", sizeof(char) * 8); + printf(" sizeof(short) = %lu bits\n", sizeof(short) * 8); + printf(" sizeof(int) = %lu bits\n", sizeof(int) * 8); + printf(" sizeof(long int) = %lu bits\n", sizeof(long int) * 8); + printf(" sizeof(long) = %lu bits\n", sizeof(long) * 8); + printf(" sizeof(long long) = %lu bits\n", sizeof(long long) * 8); + printf(" sizeof(float) = %lu bits\n", sizeof(float) * 8); + printf(" sizeof(double) = %lu bits\n", sizeof(double) * 8); + printf(" sizeof(long double) = %lu bits\n", sizeof(long double) * 8); + printf(" sizeof(char *) = %lu bits\n", sizeof(char *) * 8); + printf(" sizeof((*)()) = %lu bits\n", sizeof(funcptr) * 8); + +#ifdef __SSE__ + printf("\nSSE types\n\n"); + printf(" sizeof(__m64) = %lu bits\n", sizeof(__m64) * 8); + printf(" sizeof(__m128) = %lu bits\n", sizeof(__m128) * 8); +#endif +#ifdef __clang__ + /* clang doesn't support __float128 */ +#else +#ifdef __SSE2__ + printf(" sizeof(__float128) = %lu bits\n", sizeof(__float128) * 8); +#endif + +#endif + printf("\n"); + return(0); +}