The Computer Language
Benchmarks Game

mandelbrot C# .NET Core #2 program

source code

/* The Computer Language Benchmarks Game
   http://benchmarksgame.alioth.debian.org/
 *
 * Adapted by Antti Lankila from the earlier Isaac Gouy's implementation
 */

using System;
using System.IO;

class Mandelbrot {

   public static void Main(String[] args) {

      int width = 100;
      if (args.Length > 0)
	 width = Int32.Parse(args[0]);

      int height = width;
      int maxiter = 50;
      double limit = 4.0;

      Console.WriteLine("P4");
      Console.WriteLine("{0} {1}", width,height);
      Stream s = Console.OpenStandardOutput(1024);

      for (int y = 0; y < height; y++) {
	 int bits = 0;
	 int xcounter = 0;
	 double Ci = 2.0*y/height - 1.0;

         for (int x = 0; x < width; x++){
	    double Zr = 0.0;
	    double Zi = 0.0;
	    double Cr = 2.0*x/width - 1.5;
            int i = maxiter;

            bits = bits << 1;
            do {
               double Tr = Zr*Zr - Zi*Zi + Cr;
               Zi = 2.0*Zr*Zi + Ci;
               Zr = Tr;
               if (Zr*Zr + Zi*Zi > limit) {
		  bits |= 1;
		  break;
	       }
            } while (--i > 0);

            if (++xcounter == 8) {
	       s.WriteByte((byte) (bits ^ 0xff));
	       bits = 0;
	       xcounter = 0;
            }
         }
         if (xcounter != 0)
	    s.WriteByte((byte) ((bits << (8 - xcounter)) ^ 0xff));
      }
   }
}
    

notes, command-line, and program output

NOTES:
64-bit Ubuntu quad core
dotnet 1.0.1 005db40cd1
"System.GC.Server": true


Sun, 16 Apr 2017 16:11:49 GMT

MAKE:
cp mandelbrot.csharpcore-2.csharpcore Program.cs
cp Include/csharpcore/tmp.csproj .
cp Include/csharpcore/runtimeconfig.template.json .
mkdir obj
cp Include/csharpcore/tmp.csproj.nuget.g.props ./obj
cp Include/csharpcore/tmp.csproj.nuget.g.targets ./obj
/usr/bin/dotnet build -c Release
Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.

Program.cs(24,26): error CS1501: No overload for method 'OpenStandardOutput' takes 1 arguments [/home/dunham/benchmarksgame_quadcore/mandelbrot/tmp/tmp.csproj]

Build FAILED.

Program.cs(24,26): error CS1501: No overload for method 'OpenStandardOutput' takes 1 arguments [/home/dunham/benchmarksgame_quadcore/mandelbrot/tmp/tmp.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:03.20
/home/dunham/benchmarksgame/nanobench/makefiles/u64q.programs.Makefile:224: recipe for target 'mandelbrot.csharpcore-2.csharpcore_run' failed
make: [mandelbrot.csharpcore-2.csharpcore_run] Error 1 (ignored)
3.70s to complete and log all make actions

COMMAND LINE:
/usr/bin/dotnet ./bin/Release/netcoreapp1.1/tmp.dll 1000

PROGRAM FAILED 


(BINARY) PROGRAM OUTPUT NOT SHOWN

No executable found matching command "dotnet-./bin/Release/netcoreapp1.1/tmp.dll"