/// <summary> /// Initializes an instnace of VertexEnv. This is called in auto-generated vertex code. /// </summary> /// <param name="args"></param> /// <param name="vertexParams"></param> public VertexEnv(string args, DryadLinqVertexParams vertexParams) { this.m_argList = args.Split('|'); this.m_nativeHandle = new IntPtr(Int64.Parse(this.m_argList[0], NumberStyles.HexNumber)); this.m_numberOfInputs = DryadLinqNative.GetNumOfInputs(this.m_nativeHandle); this.m_numberOfOutputs = DryadLinqNative.GetNumOfOutputs(this.m_nativeHandle); this.m_nextInput = 0; this.m_nextInputPort = 0; this.m_nextOutputPort = 0; this.m_vertexParams = vertexParams; this.m_useLargeBuffer = vertexParams.UseLargeBuffer; if (this.m_numberOfOutputs > 0) { this.SetInitialWriteSizeHint(); } // Set the thread count for DryadLINQ vertex runtime string threadCountStr = Environment.GetEnvironmentVariable("DRYAD_THREADS_PER_WORKER"); DryadLinqVertex.ThreadCount = Environment.ProcessorCount; if (!String.IsNullOrEmpty(threadCountStr)) { if (!Int32.TryParse(threadCountStr, out DryadLinqVertex.ThreadCount)) { throw new DryadLinqException("The env variable DRYAD_THREADS_PER_WORKER was set to " + threadCountStr); } if (DryadLinqVertex.ThreadCount < 1) { DryadLinqVertex.ThreadCount = Environment.ProcessorCount; } } }
/// <summary> /// Initializes an instnace of VertexEnv. This is called in auto-generated code. /// </summary> /// <param name="args"></param> /// <param name="vertexParams"></param> public VertexEnv(string args, DryadLinqVertexParams vertexParams) { this.m_argList = args.Split('|'); this.m_nativeHandle = new IntPtr(Int64.Parse(this.m_argList[0], NumberStyles.HexNumber)); this.m_numberOfInputs = DryadLinqNative.GetNumOfInputs(this.m_nativeHandle); this.m_numberOfOutputs = DryadLinqNative.GetNumOfOutputs(this.m_nativeHandle); this.m_nextInput = 0; this.m_nextInputPort = 0; this.m_nextOutputPort = 0; this.m_vertexParams = vertexParams; this.m_useLargeBuffer = vertexParams.UseLargeBuffer; this.m_multiThreading = vertexParams.MultiThreading; if (this.m_numberOfOutputs > 0) { this.SetInitialWriteSizeHint(); } Debug.Assert(vertexParams.InputArity <= this.m_numberOfInputs); Debug.Assert(vertexParams.OutputArity <= this.m_numberOfOutputs); }