示例#1
0
void printHeader()
{

    std::cout
        << std::string( 5, '*' )
        << " "
        << getTestMode()
        << " * "
        << getCompilerName()
        << " * "
        << getRandomMode()
        << " "
        << std::string( 5, '*' )
        << "\n"
        << std::endl;
}
示例#2
0
  RTCORE_API void rtcInit(const char* cfg) 
  {
      cout << "in rtcInit " << endl;
    Lock<MutexSys> lock(g_mutex);
    TRACE(rtcInit);
    CATCH_BEGIN;

    if (g_initialized) {
      g_mutex.unlock();
      process_error(RTC_INVALID_OPERATION,"already initialized");
      g_mutex.lock();
      return;
    }
    g_initialized = true;

    /* reset global state */
    initSettings();
    
    if (cfg != NULL) 
    {
      size_t pos = 0;
      do {
        std::string tok = parseIdentifier (cfg,pos);

        if (tok == "threads" && parseSymbol(cfg,'=',pos)) 
	{
	  g_numThreads = parseInt(cfg,pos);
#if defined(__MIC__)
	  if (!(g_numThreads == 1 || (g_numThreads % 4) == 0)) {
	    g_mutex.unlock();
	    process_error(RTC_INVALID_OPERATION,"Xeon Phi supports only number of threads % 4 == 0, or threads == 1");
	    g_mutex.lock();
            return;
          }
#endif
        }
        else if (tok == "isa" && parseSymbol (cfg,'=',pos)) 
	{
	  std::string isa = parseIdentifier (cfg,pos);
	  if      (isa == "sse" ) cpu_features = SSE;
	  else if (isa == "sse2") cpu_features = SSE2;
	  else if (isa == "sse3") cpu_features = SSE3;
	  else if (isa == "ssse3") cpu_features = SSSE3;
	  else if (isa == "sse41") cpu_features = SSE41;
	  else if (isa == "sse42") cpu_features = SSE42;
	  else if (isa == "avx") cpu_features = AVX;
	  else if (isa == "avxi") cpu_features = AVXI;
	  else if (isa == "avx2") cpu_features = AVX2;
	}
        else if ((tok == "tri_accel" || tok == "accel") && parseSymbol (cfg,'=',pos))
            g_tri_accel = parseIdentifier (cfg,pos);
	else if ((tok == "tri_builder" || tok == "builder") && parseSymbol (cfg,'=',pos))
	    g_tri_builder = parseIdentifier (cfg,pos);
	else if ((tok == "tri_traverser" || tok == "traverser") && parseSymbol (cfg,'=',pos))
            g_tri_traverser = parseIdentifier (cfg,pos);
      	else if ((tok == "tri_accel_mb" || tok == "accel_mb") && parseSymbol (cfg,'=',pos))
            g_tri_accel = parseIdentifier (cfg,pos);
	else if ((tok == "tri_builder_mb" || tok == "builder_mb") && parseSymbol (cfg,'=',pos))
	    g_tri_builder = parseIdentifier (cfg,pos);
        else if ((tok == "tri_traverser_mb" || tok == "traverser_mb") && parseSymbol (cfg,'=',pos))
            g_tri_traverser = parseIdentifier (cfg,pos);
        else if (tok == "hair_accel" && parseSymbol (cfg,'=',pos))
            g_hair_accel = parseIdentifier (cfg,pos);
	else if (tok == "hair_builder" && parseSymbol (cfg,'=',pos))
            g_hair_builder = parseIdentifier (cfg,pos);
	else if (tok == "hair_traverser" && parseSymbol (cfg,'=',pos))
            g_hair_traverser = parseIdentifier (cfg,pos);
	else if (tok == "hair_builder_replication_factor" && parseSymbol (cfg,'=',pos))
            g_hair_builder_replication_factor = parseInt (cfg,pos);
	
        else if (tok == "verbose" && parseSymbol (cfg,'=',pos))
            g_verbose = parseInt (cfg,pos);
	else if (tok == "benchmark" && parseSymbol (cfg,'=',pos))
            g_benchmark = parseInt (cfg,pos);
        else if (tok == "flags") {
          g_scene_flags = 0;
          if (parseSymbol (cfg,'=',pos)) {
            do {
              std::string flag = parseIdentifier (cfg,pos);
              if      (flag == "static" ) g_scene_flags |= RTC_SCENE_STATIC;
              else if (flag == "dynamic") g_scene_flags |= RTC_SCENE_DYNAMIC;
              else if (flag == "compact") g_scene_flags |= RTC_SCENE_COMPACT;
              else if (flag == "coherent") g_scene_flags |= RTC_SCENE_COHERENT;
              else if (flag == "incoherent") g_scene_flags |= RTC_SCENE_INCOHERENT;
              else if (flag == "high_quality") g_scene_flags |= RTC_SCENE_HIGH_QUALITY;
              else if (flag == "robust") g_scene_flags |= RTC_SCENE_ROBUST;
            } while (parseSymbol (cfg,',',pos));
          }
        }
        
      } while (findNext (cfg,',',pos));
    }

    if (g_verbose >= 1)
    {
      std::cout << "Embree Ray Tracing Kernels " << __EMBREE_VERSION__ << " (" << __DATE__ << ")" << std::endl;
      std::cout << "  Compiler : " << getCompilerName() << std::endl;
      std::cout << "  Platform : " << getPlatformName() << std::endl;
      std::cout << "  CPU      : " << stringOfCPUFeatures(getCPUFeatures()) << std::endl;
      std::cout << "  Features : ";
#if defined(__USE_RAY_MASK__)
      std::cout << "raymasks ";
#endif
#if defined (__BACKFACE_CULLING__)
      std::cout << "backfaceculling ";
#endif
#if defined(__INTERSECTION_FILTER__)
      std::cout << "intersection_filter ";
#endif
#if defined(__BUFFER_STRIDE__)
      std::cout << "bufferstride ";
#endif
      std::cout << std::endl;

#if defined (__MIC__)
#if defined(__BUFFER_STRIDE__)
      std::cout << "  WARNING: enabled 'bufferstride' support will lower BVH build performance" << std::endl;
#endif
#endif
    }

    /* CPU has to support at least SSE2 */
#if !defined (__MIC__)
    if (!has_feature(SSE2)) {
      g_mutex.unlock();
      process_error(RTC_UNSUPPORTED_CPU,"CPU does not support SSE2");
      g_mutex.lock();
      return;
    }
#endif

    g_error = createTls();
    g_error_function = NULL;

    init_globals();
    cout << "in rtcInit(), BVH4Register() " << endl;
#if !defined(__MIC__)
    cout << "BVH4Register()" << endl;
    BVH4Register();
#else
    cout << "BVH4iRegister() " << endl;
    BVH4iRegister();
#endif 
    cout << "BVH4MBRegister() " << endl;
    BVH4MBRegister();
    BVH4HairRegister();    
#if defined(__TARGET_AVX__)
    cout << "BVH8Register() " << endl;
    if (has_feature(AVX)) {
      BVH8Register();
    }
#endif
    
    InstanceIntersectorsRegister();

//if (g_verbose >= 2) 
    printSettings();
    
    TaskScheduler::create(g_numThreads);

    cout << " end rtcInit " << endl;
    CATCH_END;
  }
示例#3
0
  void Device::print()
  {
    const int cpu_features = getCPUFeatures();
    std::cout << std::endl;
    std::cout << "Embree Ray Tracing Kernels " << RTC_VERSION_STRING << " (" << RTC_HASH << ")" << std::endl;
    std::cout << "  Compiler  : " << getCompilerName() << std::endl;
    std::cout << "  Build     : ";
#if defined(DEBUG)
    std::cout << "Debug " << std::endl;
#else
    std::cout << "Release " << std::endl;
#endif
    std::cout << "  Platform  : " << getPlatformName() << std::endl;
    std::cout << "  CPU       : " << stringOfCPUModel(getCPUModel()) << " (" << getCPUVendor() << ")" << std::endl;
    std::cout << "   Threads  : " << getNumberOfLogicalThreads() << std::endl;
    std::cout << "   ISA      : " << stringOfCPUFeatures(cpu_features) << std::endl;
    std::cout << "   Targets  : " << supportedTargetList(cpu_features) << std::endl;
    const bool hasFTZ = _mm_getcsr() & _MM_FLUSH_ZERO_ON;
    const bool hasDAZ = _mm_getcsr() & _MM_DENORMALS_ZERO_ON;
    std::cout << "   MXCSR    : " << "FTZ=" << hasFTZ << ", DAZ=" << hasDAZ << std::endl;
    std::cout << "  Config" << std::endl;
    std::cout << "    Threads : " << (numThreads ? toString(numThreads) : std::string("default")) << std::endl;
    std::cout << "    ISA     : " << stringOfCPUFeatures(enabled_cpu_features) << std::endl;
    std::cout << "    Targets : " << supportedTargetList(enabled_cpu_features) << " (supported)" << std::endl;
    std::cout << "              " << getEnabledTargets() << " (compile time enabled)" << std::endl;
    std::cout << "    Features: " << getEmbreeFeatures() << std::endl;
    std::cout << "    Tasking : ";
#if defined(TASKING_TBB)
    std::cout << "TBB" << TBB_VERSION_MAJOR << "." << TBB_VERSION_MINOR << " ";
    std::cout << "TBB_header_interface_" << TBB_INTERFACE_VERSION << " TBB_lib_interface_" << tbb::TBB_runtime_interface_version() << " ";
#endif
#if defined(TASKING_INTERNAL)
    std::cout << "internal_tasking_system ";
#endif
#if defined(TASKING_PPL)
	std::cout << "PPL ";
#endif
    std::cout << std::endl;

    /* check of FTZ and DAZ flags are set in CSR */
    if (!hasFTZ || !hasDAZ) 
    {
#if !defined(_DEBUG)
      if (State::verbosity(1)) 
#endif
      {
        std::cout << std::endl;
        std::cout << "================================================================================" << std::endl;
        std::cout << "  WARNING: \"Flush to Zero\" or \"Denormals are Zero\" mode not enabled "         << std::endl 
                  << "           in the MXCSR control and status register. This can have a severe "     << std::endl
                  << "           performance impact. Please enable these modes for each application "   << std::endl
                  << "           thread the following way:" << std::endl
                  << std::endl 
                  << "           #include \"xmmintrin.h\"" << std::endl 
                  << "           #include \"pmmintrin.h\"" << std::endl 
                  << std::endl 
                  << "           _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);" << std::endl 
                  << "           _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);" << std::endl;
        std::cout << "================================================================================" << std::endl;
        std::cout << std::endl;
      }
    }
    std::cout << std::endl;
  }
示例#4
0
/*
    Tokens:
    ARCH        Build architecture (64)
    GCC_ARCH    ARCH mapped to gcc -arch switches (x86_64)
    CC          Compiler (cc)
    DEBUG       Debug compilation options (-g, -Zi -Od)
    INC         Include directory out/inc
    LIB         Library directory (out/lib, xcode/VS: out/bin)
    LIBS        Libraries required to link with ESP
    OBJ         Name of compiled source (out/lib/view-MD5.o)
    MOD         Output module (view_MD5.dylib)
    SHLIB       Host Shared library (.lib, .so)
    SHOBJ       Host Shared Object (.dll, .so)
    SRC         Source code for view or controller (already templated)
    TMP         Temp directory
    VS          Visual Studio directory
    WINSDK      Windows SDK directory
 */
PUBLIC char *espExpandCommand(EspRoute *eroute, cchar *command, cchar *source, cchar *module)
{
    MprBuf      *buf;
    MaAppweb    *appweb;
    cchar       *cp, *outputModule, *os, *arch, *profile;
    char        *tmp;
    
    if (command == 0) {
        return 0;
    }
    appweb = MPR->appwebService;
    outputModule = mprTrimPathExt(module);
    maParsePlatform(appweb->platform, &os, &arch, &profile);
    buf = mprCreateBuf(-1, -1);

    for (cp = command; *cp; ) {
		if (*cp == '$') {
            if (matchToken(&cp, "${ARCH}")) {
                /* Target architecture (x86|mips|arm|x64) */
                mprPutStringToBuf(buf, arch);

            } else if (matchToken(&cp, "${GCC_ARCH}")) {
                /* Target architecture mapped to GCC mtune|mcpu values */
                mprPutStringToBuf(buf, getMappedArch(arch));

            } else if (matchToken(&cp, "${INC}")) {
                /* Include directory for the configuration */
                mprPutStringToBuf(buf, mprJoinPath(appweb->platformDir, "inc")); 

            } else if (matchToken(&cp, "${LIBPATH}")) {
                /* Library directory for Appweb libraries for the target */
                mprPutStringToBuf(buf, mprJoinPath(appweb->platformDir, "bin")); 

            } else if (matchToken(&cp, "${LIBS}")) {
                /* Required libraries to link. These may have nested ${TOKENS} */
                mprPutStringToBuf(buf, espExpandCommand(eroute, getLibs(os), source, module));

            } else if (matchToken(&cp, "${MOD}")) {
                /* Output module path in the cache without extension */
                mprPutStringToBuf(buf, outputModule);

            } else if (matchToken(&cp, "${OBJ}")) {
                /* Output object with extension (.o) in the cache directory */
                mprPutStringToBuf(buf, mprJoinPathExt(outputModule, getObjExt(os)));

            } else if (matchToken(&cp, "${OS}")) {
                /* Target architecture (freebsd|linux|macosx|windows|vxworks) */
                mprPutStringToBuf(buf, os);

            } else if (matchToken(&cp, "${SHLIB}")) {
                /* .dll, .so, .dylib */
                mprPutStringToBuf(buf, getShlibExt(os));

            } else if (matchToken(&cp, "${SHOBJ}")) {
                /* .dll, .so, .dylib */
                mprPutStringToBuf(buf, getShobjExt(os));

            } else if (matchToken(&cp, "${SRC}")) {
                /* View (already parsed into C code) or controller source */
                mprPutStringToBuf(buf, source);

            } else if (matchToken(&cp, "${TMP}")) {
                if ((tmp = getenv("TMPDIR")) == 0) {
                    if ((tmp = getenv("TMP")) == 0) {
                        tmp = getenv("TEMP");
                    }
                }
                mprPutStringToBuf(buf, tmp ? tmp : ".");

            } else if (matchToken(&cp, "${VS}")) {
                mprPutStringToBuf(buf, getVisualStudio());

            } else if (matchToken(&cp, "${VXCPU}")) {
                mprPutStringToBuf(buf, getVxCPU(arch));

            } else if (matchToken(&cp, "${WINSDK}")) {
                mprPutStringToBuf(buf, getWinSDK());

            /*
                These vars can be configured from environment variables.
                NOTE: the default esp.conf includes "esp->vxworks.conf" which has EspEnv definitions for the configured 
                VxWorks toolchain
             */
            } else if (matchToken(&cp, "${CC}")) {
                mprPutStringToBuf(buf, getEnvString(eroute, "CC", getCompilerPath(os, arch)));
            } else if (matchToken(&cp, "${LINK}")) {
                mprPutStringToBuf(buf, getEnvString(eroute, "LINK", ""));
            } else if (matchToken(&cp, "${CFLAGS}")) {
                mprPutStringToBuf(buf, getEnvString(eroute, "CFLAGS", ""));
            } else if (matchToken(&cp, "${DEBUG}")) {
                mprPutStringToBuf(buf, getEnvString(eroute, "DEBUG", getDebug()));
            } else if (matchToken(&cp, "${LDFLAGS}")) {
                mprPutStringToBuf(buf, getEnvString(eroute, "LDFLAGS", ""));

            } else if (matchToken(&cp, "${WIND_BASE}")) {
                mprPutStringToBuf(buf, getEnvString(eroute, "WIND_BASE", WIND_BASE));
            } else if (matchToken(&cp, "${WIND_HOME}")) {
                mprPutStringToBuf(buf, getEnvString(eroute, "WIND_HOME", WIND_HOME));
            } else if (matchToken(&cp, "${WIND_HOST_TYPE}")) {
                mprPutStringToBuf(buf, getEnvString(eroute, "WIND_HOST_TYPE", WIND_HOST_TYPE));
            } else if (matchToken(&cp, "${WIND_PLATFORM}")) {
                mprPutStringToBuf(buf, getEnvString(eroute, "WIND_PLATFORM", WIND_PLATFORM));
            } else if (matchToken(&cp, "${WIND_GNU_PATH}")) {
                mprPutStringToBuf(buf, getEnvString(eroute, "WIND_GNU_PATH", WIND_GNU_PATH));
            } else if (matchToken(&cp, "${WIND_CCNAME}")) {
                mprPutStringToBuf(buf, getEnvString(eroute, "WIND_CCNAME", getCompilerName(os, arch)));
            } else {
                mprPutCharToBuf(buf, *cp++);
            }
        } else {
            mprPutCharToBuf(buf, *cp++);
        }
    }
    mprAddNullToBuf(buf);
    return sclone(mprGetBufStart(buf));
}