diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 92ca363043..fa3cfc619c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -79,6 +79,8 @@ build-windows-msvc: ### RELEASE JOBS ### +# NOTE(jda) - Current CentOS 6 release machine needs gcc environment +# debugged #release-linux-gcc: # type: deploy # script: @@ -112,6 +114,7 @@ release-linux-icc: only: - devel - master + - release-0.10 artifacts: paths: - build_release/*.gz @@ -129,6 +132,7 @@ release-osx-clang: only: - devel - master + - release-0.10 artifacts: paths: - build_release/*.gz @@ -145,6 +149,7 @@ release-windows: only: - devel - master + - release-0.10 artifacts: paths: - build_release\ospray*.zip diff --git a/CHANGELOG.md b/CHANGELOG.md index 899ea57a57..1f668bd809 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Version History --------------- +### Changes in v0.10.1: +- Fixed support of first generation Intel® Xeon Phi™ coprocessor + (codename Knights Corner) +- Restored missing implementation of `ospRemoveVolume()` + ### Changes in v0.10.0: - Added new tasking options: `Cilk`, `Internal`, and `Debug` @@ -9,7 +14,8 @@ Version History - `Cilk`: Use Intel® Cilk™ Plus language extensions (ICC only) - `Internal`: Use hand written OSPRay tasking system - `Debug`: All tasks are run in serial (useful for debugging) - - In most cases, `TBB` remains the fastest option + - In most cases, Intel Threading Building Blocks (Intel `TBB`) + remains the fastest option - Added support for adaptive accumulation and stopping - `ospRenderFrame` now returns an estimation of the variance in the rendered image if the framebuffer was created with the @@ -51,8 +57,8 @@ Version History renders them - Ambient occlusion works with implicit isosurfaces, with a known visual quality/performance trade-off -- Intel® Xeon Phi™ (codename Knights Corner) COI device and build - infrastructure restored (volume rendering is known to still be +- Intel Xeon Phi coprocessor (codename Knights Corner) COI device and + build infrastructure restored (volume rendering is known to still be broken) - New support for CPack built OSPRay binary redistributable packages - Added support for HDRI lighting in path tracer @@ -66,8 +72,9 @@ Version History - Trianglemesh postIntersect shading is now 64-bit safe - Texture2D has been reworked, with many improvements and bug fixes - Fixed bug where MPI device would freeze while rendering frames - with TBB - - Updates to CMake with better error messages when TBB is missing + with Intel TBB + - Updates to CMake with better error messages when Intel TBB is + missing ### Changes in v0.9.0: @@ -80,9 +87,9 @@ changes. functionality of "obj" and "ao" renderers - Ambient occlusion is quite flexible: dynamic number of samples, maximum ray distance, and weight -- Updated Embree version to v2.7.1 with native support for AVX512 for - triangle mesh surface rendering on the Intel Xeon Phi processor - (codename Knights Landing) +- Updated Embree version to v2.7.1 with native support for Intel + AVX-512 for triangle mesh surface rendering on the Intel Xeon Phi + processor (codename Knights Landing) - OSPRay now uses C++11 features, requiring up to date compiler and standard library versions (GCC v4.8.0) - Optimization of volume sampling resulting in volume rendering @@ -93,8 +100,8 @@ changes. material - Support for alpha and depth components of framebuffer - Added thinlens camera, i.e. support for depth of field -- Tasking system has been updated to use Intel® Threading Building - Blocks (TBB) +- Tasking system has been updated to use Intel Threading Building + Blocks (Intel TBB) - The `ospGet*()` API calls have been deprecated and will be removed in a subsequent release @@ -126,7 +133,7 @@ changes. ### Changes in v0.8.2: -- Initial support for AVX512 and the Intel® Xeon Phi™ processor +- Initial support for Intel AVX-512 and the Intel Xeon Phi processor (codename Knights Landing) - Performance improvements to the volume renderer - Incorporated implicit slices and isosurfaces of volumes as core diff --git a/CMakeLists.txt b/CMakeLists.txt index bbb595f5e3..a5b3791088 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ ENDIF() SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake) SET(OSPRAY_VERSION_MAJOR 0) SET(OSPRAY_VERSION_MINOR 10) -SET(OSPRAY_VERSION_PATCH 0) +SET(OSPRAY_VERSION_PATCH 1) SET(OSPRAY_VERSION ${OSPRAY_VERSION_MAJOR}.${OSPRAY_VERSION_MINOR}.${OSPRAY_VERSION_PATCH} ) @@ -40,8 +40,10 @@ SET(OSPRAY_SOVERSION 0) SET(CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo") IF (WIN32) IF (NOT OSPRAY_DEFAULT_CMAKE_CONFIGURATION_TYPES_SET) - SET(CMAKE_CONFIGURATION_TYPES "${CONFIGURATION_TYPES}" CACHE STRING "List of generated configurations." FORCE) - SET(OSPRAY_DEFAULT_CMAKE_CONFIGURATION_TYPES_SET ON CACHE INTERNAL "Default CMake configuration types set.") + SET(CMAKE_CONFIGURATION_TYPES "${CONFIGURATION_TYPES}" + CACHE STRING "List of generated configurations." FORCE) + SET(OSPRAY_DEFAULT_CMAKE_CONFIGURATION_TYPES_SET ON + CACHE INTERNAL "Default CMake configuration types set.") ENDIF() ELSE() IF(NOT CMAKE_BUILD_TYPE) diff --git a/README.md b/README.md index b900753ea3..c2a3efe06b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ OSPRay ====== -This is release v0.10.0 of OSPRay. For changes and new features see the +This is release v0.10.1 of OSPRay. For changes and new features see the [changelog](CHANGELOG.md). Also visit http://www.ospray.org for more information. @@ -23,7 +23,7 @@ compute nodes in HPC systems. OSPRay internally builds on top of [Embree](https://embree.github.io/) and [ISPC (Intel® SPMD Program Compiler)](https://ispc.github.io/), and fully utilizes modern instruction sets like Intel® SSE, AVX, AVX2, -or Intel® Xeon Phi™ to achieve high rendering performance. +and AVX-512 to achieve high rendering performance. OSPRay Support and Contact diff --git a/apps/qtViewer/sg/geometry/TriangleMesh.cpp b/apps/qtViewer/sg/geometry/TriangleMesh.cpp index 32d74bd49d..f2681e39b5 100644 --- a/apps/qtViewer/sg/geometry/TriangleMesh.cpp +++ b/apps/qtViewer/sg/geometry/TriangleMesh.cpp @@ -116,7 +116,6 @@ namespace ospray { /*! 'render' the nodes */ void PTMTriangleMesh::render(RenderContext &ctx) { - PRINT(this); if (ospGeometry) return; assert(ctx.world); @@ -124,8 +123,10 @@ namespace ospray { ospGeometry = ospNewGeometry("trianglemesh"); // set vertex arrays - if (vertex && vertex->notEmpty()) - ospSetData(ospGeometry,"vertex",vertex->getOSP()); + if (vertex && vertex->notEmpty()) { + OSPData data = vertex->getOSP(); + ospSetData(ospGeometry,"vertex",data); + } if (normal && normal->notEmpty()) ospSetData(ospGeometry,"vertex.normal",normal->getOSP()); if (texcoord && texcoord->notEmpty()) diff --git a/apps/volumeViewer/QOSPRayWindow.cpp b/apps/volumeViewer/QOSPRayWindow.cpp index 3e54c39a7b..3416ee7275 100644 --- a/apps/volumeViewer/QOSPRayWindow.cpp +++ b/apps/volumeViewer/QOSPRayWindow.cpp @@ -25,9 +25,9 @@ std::ostream &operator<<(std::ostream &o, const Viewport &viewport) { - o << "-vp " << viewport.from.x << " " << viewport.from.y << " " << viewport.from.z - << " -vi " << viewport.at.x << " " << viewport.at.y << " " << viewport.at.z - << " -vu " << viewport.up.x << " " << viewport.up.y << " " << viewport.up.z + o << "--vp " << viewport.from.x << " " << viewport.from.y << " " << viewport.from.z + << " --vi " << viewport.at.x << " " << viewport.at.y << " " << viewport.at.z + << " --vu " << viewport.up.x << " " << viewport.up.y << " " << viewport.up.z << std::endl; return o; diff --git a/apps/volumeViewer/VolumeViewer.cpp b/apps/volumeViewer/VolumeViewer.cpp index b4a045d24c..9027712f86 100644 --- a/apps/volumeViewer/VolumeViewer.cpp +++ b/apps/volumeViewer/VolumeViewer.cpp @@ -250,6 +250,13 @@ void VolumeViewer::screenshot(std::string filename) std::cout << (success ? "saved screenshot to " : "failed saving screenshot ") << filename << std::endl; } +void VolumeViewer::keyPressEvent(QKeyEvent * event) +{ + if (event->key() == Qt::Key_Escape){ + close(); + } +} + void VolumeViewer::commitVolumes() { for(size_t i=0; i +void printUsage(const char *exeName) +{ + std::cerr << "\n USAGE: " << exeName << " [filenames...] [options]\n" + << " \n" + << " Options:\n" + << " --benchmark run benchmark and report overall frame rate\n" + << " --dt
use ray cast sample step size 'dt'\n" + << " --module load the module 'moduleName'\n" + << " --ply load PLY geometry from 'filename'\n" + << " --rotate automatically rotate view according to 'rate'\n" + << " --fps,--show-framerate show the frame rate in the window title bar\n" + << " --fullscreen enter fullscreen mode\n" + << " --own-model-per-object create a separate model for each object\n" + << " --slice load volume slice from 'filename'\n" + << " --transferfunction load transfer function from 'filename'\n" + << " --viewsize x force OSPRay view size to 'width'x'height'\n" + << " --vu set viewport up vector to ('x', 'y', 'z')\n" + << " --vp set camera position ('x', 'y', 'z')\n" + << " --vi set look at position ('x', 'y', 'z')\n" + << " -r,--renderer set renderer to use\n" + << " --writeframes emit frames to 'filename_xxxxx.ppm'\n" + << " --benchmark perform benchmarking\n" + << " -h,--help print this message\n" + << " \n"; +} + int main(int argc, char *argv[]) { // Initialize OSPRay. @@ -36,36 +62,10 @@ int main(int argc, char *argv[]) // Print the command line usage. if (argc < 2) { - - std::cerr << " " << std::endl; - std::cerr << " USAGE: " << argv[0] << " [filename] ... [options]" << std::endl; - std::cerr << " " << std::endl; - std::cerr << " Options:" << std::endl; - std::cerr << " " << std::endl; - std::cerr << " -benchmark : run benchmark and report overall frame rate" << std::endl; - std::cerr << " -dt
: use ray cast sample step size 'dt'" << std::endl; - std::cerr << " -module : load the module 'moduleName'" << std::endl; - std::cerr << " -ply : load PLY geometry from 'filename'" << std::endl; - std::cerr << " -rotate : automatically rotate view according to 'rate'" << std::endl; - std::cerr << " -showframerate : show the frame rate in the window title bar" << std::endl; - std::cerr << " -fullscreen : enter fullscreen mode" << std::endl; - std::cerr << " -ownmodelperobject : create a separate model for each object" << std::endl; - std::cerr << " -slice : load volume slice from 'filename'" << std::endl; - std::cerr << " -transferfunction : load transfer function from 'filename'" << std::endl; - std::cerr << " -viewsize x : force OSPRay view size to 'width'x'height'" << std::endl; - std::cerr << " -viewup : set viewport up vector to ('x', 'y', 'z')" << std::endl; - std::cerr << " -writeframes : emit frames to 'filename_xxxxx.ppm'" << std::endl; - std::cerr << " " << std::endl; - + printUsage(argv[0]); return 1; } - // // Parse the OSPRay object file filenames. - // std::vector objectFileFilenames; - - // for (size_t i=1 ; (i < argc) && (argv[i][0] != '-') ; i++) - // objectFileFilenames.push_back(std::string(argv[i])); - // Default values for the optional command line arguments. float dt = 0.0f; std::vector plyFilenames; @@ -86,68 +86,66 @@ int main(int argc, char *argv[]) std::vector inFileName; // Parse the optional command line arguments. - for (int i=// objectFileFilenames.size() + - 1 ; i < argc ; i++) { + for (int i = 1; i < argc; ++i) { const std::string arg = argv[i]; - if (arg == "-dt") { + if (arg == "--dt") { if (i + 1 >= argc) throw std::runtime_error("missing
argument"); dt = atof(argv[++i]); std::cout << "got dt = " << dt << std::endl; - } else if (arg == "-ply") { + } else if (arg == "--ply") { - // Note: we use "-ply" since "-geometry" gets parsed elsewhere... if (i + 1 >= argc) throw std::runtime_error("missing argument"); plyFilenames.push_back(std::string(argv[++i])); std::cout << "got PLY filename = " << plyFilenames.back() << std::endl; - } else if (arg == "-rotate") { + } else if (arg == "--rotate") { if (i + 1 >= argc) throw std::runtime_error("missing argument"); rotationRate = atof(argv[++i]); std::cout << "got rotationRate = " << rotationRate << std::endl; - } else if (arg == "-slice") { + } else if (arg == "--slice") { if (i + 1 >= argc) throw std::runtime_error("missing argument"); sliceFilenames.push_back(std::string(argv[++i])); std::cout << "got slice filename = " << sliceFilenames.back() << std::endl; - } else if (arg == "-showframerate" || arg == "-fps") { + } else if (arg == "--show-framerate" || arg == "--fps") { showFrameRate = true; std::cout << "set show frame rate" << std::endl; - } else if (arg == "-fullscreen") { + } else if (arg == "--fullscreen") { fullScreen = true; std::cout << "go full screen" << std::endl; - } else if (arg == "-ownmodelperobject") { + } else if (arg == "--own-model-per-object") { ownModelPerObject = true; - } else if (arg == "-transferfunction") { + } else if (arg == "--transferfunction") { if (i + 1 >= argc) throw std::runtime_error("missing argument"); transferFunctionFilename = std::string(argv[++i]); std::cout << "got transferFunctionFilename = " << transferFunctionFilename << std::endl; - } else if (arg == "-benchmark") { + } else if (arg == "--benchmark") { if (i + 2 >= argc) throw std::runtime_error("missing arguments"); benchmarkWarmUpFrames = atoi(argv[++i]); benchmarkFrames = atoi(argv[++i]); std::cout << "got benchmarkWarmUpFrames = " << benchmarkWarmUpFrames << ", benchmarkFrames = " << benchmarkFrames << std::endl; - } else if (arg == "-r" || arg == "-renderer") { + } else if (arg == "-r" || arg == "--renderer") { renderer = argv[++i]; - } else if (arg == "-viewsize") { + } else if (arg == "--viewsize") { if (i + 1 >= argc) throw std::runtime_error("missing x argument"); std::string arg2(argv[++i]); @@ -162,7 +160,7 @@ int main(int argc, char *argv[]) } else throw std::runtime_error("improperly formatted x argument"); - } else if (arg == "-viewup" || arg == "-vu") { + } else if (arg == "--vu") { if (i + 3 >= argc) throw std::runtime_error("missing arguments"); @@ -170,9 +168,9 @@ int main(int argc, char *argv[]) viewUp.y = atof(argv[++i]); viewUp.z = atof(argv[++i]); - std::cout << "got viewup (-vu) = " << viewUp.x << " " << viewUp.y << " " << viewUp.z << std::endl; + std::cout << "got viewup (--vu) = " << viewUp.x << " " << viewUp.y << " " << viewUp.z << std::endl; - } else if (arg == "-vp") { + } else if (arg == "--vp") { if (i + 3 >= argc) throw std::runtime_error("missing arguments"); @@ -180,9 +178,9 @@ int main(int argc, char *argv[]) viewFrom.y = atof(argv[++i]); viewFrom.z = atof(argv[++i]); - std::cout << "got view-from (-vp) = " << viewFrom.x << " " << viewFrom.y << " " << viewFrom.z << std::endl; + std::cout << "got view-from (--vp) = " << viewFrom.x << " " << viewFrom.y << " " << viewFrom.z << std::endl; - } else if (arg == "-vi") { + } else if (arg == "--vi") { if (i + 3 >= argc) throw std::runtime_error("missing arguments"); @@ -190,15 +188,15 @@ int main(int argc, char *argv[]) viewAt.y = atof(argv[++i]); viewAt.z = atof(argv[++i]); - std::cout << "got view-at (-vi) = " << viewAt.x << " " << viewAt.y << " " << viewAt.z << std::endl; + std::cout << "got view-at (--vi) = " << viewAt.x << " " << viewAt.y << " " << viewAt.z << std::endl; - } else if (arg == "-writeframes") { + } else if (arg == "--writeframes") { - if (i + 1 >= argc || argv[i + 1][0] == '-') throw std::runtime_error("the '-writeframes' option requires a filename argument"); + if (i + 1 >= argc || argv[i + 1][0] == '-') throw std::runtime_error("the '--writeframes' option requires a filename argument"); writeFramesFilename = argv[++i]; std::cout << "got writeFramesFilename = " << writeFramesFilename << std::endl; - } else if (arg == "-module") { + } else if (arg == "--module") { if (i + 1 >= argc) throw std::runtime_error("missing argument"); std::string moduleName = argv[++i]; @@ -210,11 +208,16 @@ int main(int argc, char *argv[]) ss << error; throw std::runtime_error("could not load module " + moduleName + ", error " + ss.str()); } - - } else if (arg[0] == '-') + } else if (arg == "-h" || arg == "--help") { + printUsage(argv[0]); + return 0; + } else if (arg[0] == '-') { + std::cerr << "Unknown parameter " + arg << std::endl; + printUsage(argv[0]); throw std::runtime_error("unknown parameter " + arg); - else + } else { inFileName.push_back(arg); + } } diff --git a/cmake/icc.cmake b/cmake/icc.cmake index a92eb9ed15..341724c4bc 100644 --- a/cmake/icc.cmake +++ b/cmake/icc.cmake @@ -14,7 +14,7 @@ ## limitations under the License. ## ## ======================================================================== ## -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -no-ansi-alias -static-intel -std=c++11") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -no-ansi-alias -std=c++11") SET(CMAKE_CXX_FLAGS_DEBUG "-DDEBUG -g") SET(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3") #SET(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -no-ansi-alias -restrict -fp-model fast -fimf-precision=low -no-prec-div -no-prec-sqrt -fma -no-inline-max-total-size -inline-factor=200 ") @@ -27,6 +27,10 @@ IF (APPLE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") # link against C++11 stdlib ENDIF() +# enable -static-intel and avoid to export ICC specific symbols from OSPRay +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-intel") +SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs=ALL") + # these flags apply ONLY to how embree is built; the rest of the ospray C++ code is ISA-agnostic SET(OSPRAY_ARCH_SSE3 "-xsse3") SET(OSPRAY_ARCH_SSSE3 "-xssse3") diff --git a/cmake/ospray.cmake b/cmake/ospray.cmake index 33ab05e8bc..24f7e0007d 100644 --- a/cmake/ospray.cmake +++ b/cmake/ospray.cmake @@ -175,7 +175,8 @@ MACRO(CONFIGURE_OSPRAY) OSPRAY_CHECK_COMPILER_SUPPORT(AVX512) IF (THIS_IS_MIC) - OPTION(OSPRAY_BUILD_COI_DEVICE "Build COI Device for OSPRay's MIC support?" ON) + OPTION(OSPRAY_BUILD_COI_DEVICE + "Build COI Device for OSPRay's MIC support?" ON) ENDIF() INCLUDE(${PROJECT_SOURCE_DIR}/cmake/ispc.cmake) diff --git a/ospray/CMakeLists.txt b/ospray/CMakeLists.txt index 9f4cf4c65d..2555698399 100644 --- a/ospray/CMakeLists.txt +++ b/ospray/CMakeLists.txt @@ -58,7 +58,8 @@ IF(OSPRAY_USE_EXTERNAL_EMBREE) # NOTE(jda) - We are using the updated Embree find_package() config, check # if we need to add TBB to EMBREE_LIBRARIES IF(${EMBREE_TASKING_TBB} AND NOT ${EMBREE_USE_PACKAGED_TBB}) - OSPRAY_WARN_ONCE(EMBREE_FORCE_TBB "WARNING: You *MUST* have TBB installed based on the Embree we found!") + OSPRAY_WARN_ONCE(EMBREE_FORCE_TBB + "WARNING: You *MUST* have TBB installed based on the Embree we found!") FIND_PACKAGE(TBB REQUIRED) SET(EMBREE_LIBRARIES ${EMBREE_LIBRARIES} ${TBB_LIBRARIES}) ENDIF() @@ -302,9 +303,7 @@ IF (OSPRAY_BUILD_COI_DEVICE) # NOTE(jda) - hardcoded paths (!)...use a find_package() here? INCLUDE_DIRECTORIES(/opt/intel/mic/coi/include) INCLUDE_DIRECTORIES(/usr/include/intel-coi) - IF (THIS_IS_MIC) - SET(OSPRAY_COI_COMPONENTS api/COIDeviceDev.cpp) - ELSE() + IF (NOT THIS_IS_MIC) SET(OSPRAY_COI_COMPONENTS api/COIDeviceHost.cpp) ENDIF() SET(OSPRAY_SOURCES ${OSPRAY_SOURCES} ${OSPRAY_COI_COMPONENTS}) diff --git a/ospray/api/API.cpp b/ospray/api/API.cpp index a78dfa5319..89850a8b80 100644 --- a/ospray/api/API.cpp +++ b/ospray/api/API.cpp @@ -29,7 +29,7 @@ #endif #if 1 -# define LOG(a) if (ospray::logLevel > 2) std::cout << "#ospray: " << a << std::endl; +# define LOG(a) if (ospray::logLevel > 2) { std::cout << "#ospray: " << a << std::endl << std::flush; fflush(0); } #else # define LOG(a) /*ignore*/ #endif @@ -233,6 +233,14 @@ extern "C" void ospAddGeometry(OSPModel model, OSPGeometry geometry) return ospray::api::Device::current->addGeometry(model,geometry); } +extern "C" void ospRemoveGeometry(OSPModel model, OSPGeometry geometry) +{ + ASSERT_DEVICE(); + Assert(model != NULL && "invalid model in ospRemoveGeometry"); + Assert(geometry != NULL && "invalid geometry in ospRemoveGeometry"); + return ospray::api::Device::current->removeGeometry(model, geometry); +} + extern "C" void ospAddVolume(OSPModel model, OSPVolume volume) { ASSERT_DEVICE(); @@ -241,19 +249,23 @@ extern "C" void ospAddVolume(OSPModel model, OSPVolume volume) return ospray::api::Device::current->addVolume(model, volume); } -extern "C" void ospRemoveGeometry(OSPModel model, OSPGeometry geometry) +extern "C" void ospRemoveVolume(OSPModel model, OSPVolume volume) { ASSERT_DEVICE(); - Assert(model != NULL && "invalid model in ospRemoveGeometry"); - Assert(geometry != NULL && "invalid geometry in ospRemoveGeometry"); - return ospray::api::Device::current->removeGeometry(model, geometry); + Assert(model != NULL && "invalid model in ospRemoveVolume"); + Assert(volume != NULL && "invalid volume in ospRemoveVolume"); + return ospray::api::Device::current->removeVolume(model, volume); } /*! create a new data buffer, with optional init data and control flags */ extern "C" OSPData ospNewData(size_t nitems, OSPDataType format, const void *init, const uint32_t flags) { ASSERT_DEVICE(); - return ospray::api::Device::current->newData(nitems,format,(void*)init,flags); + LOG("ospSetData(...)"); + LOG("ospSetData(...," << nitems << "," << ((int)format) << "," << ((int*)init) << "," << flags << ",...)"); + OSPData data = ospray::api::Device::current->newData(nitems,format,(void*)init,flags); + LOG("DONE ospSetData(...,\"" << nitems << "," << ((int)format) << "," << ((int*)init) << "," << flags << ",...)"); + return data; } /*! add a data array to another object */ @@ -347,6 +359,7 @@ extern "C" OSPGeometry ospNewGeometry(const char *type) OSPGeometry geometry = ospray::api::Device::current->newGeometry(type); if ((ospray::logLevel > 0) && (geometry == NULL)) std::cerr << "#ospray: could not create geometry '" << type << "'" << std::endl; + LOG("DONE ospNewGeometry(" << type << ") >> " << (int *)geometry); return geometry; } @@ -474,10 +487,9 @@ extern "C" float ospRenderFrame(OSPFrameBuffer fb, extern "C" void ospCommit(OSPObject object) { // assert(!rendering); - + LOG("ospCommit(...)"); ASSERT_DEVICE(); Assert(object && "invalid object handle to commit to"); - LOG("ospCommit(...)"); ospray::api::Device::current->commit(object); } diff --git a/ospray/api/COIDeviceDev.cpp b/ospray/api/COIDeviceDev.cpp deleted file mode 100644 index 2c85cd6cf6..0000000000 --- a/ospray/api/COIDeviceDev.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// ======================================================================== // -// Copyright 2009-2016 Intel Corporation // -// // -// Licensed under the Apache License, Version 2.0 (the "License"); // -// you may not use this file except in compliance with the License. // -// You may obtain a copy of the License at // -// // -// http://www.apache.org/licenses/LICENSE-2.0 // -// // -// Unless required by applicable law or agreed to in writing, software // -// distributed under the License is distributed on an "AS IS" BASIS, // -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // -// See the License for the specific language governing permissions and // -// limitations under the License. // -// ======================================================================== // - -#include "Device.h" - -namespace ospray { - using std::cout; - using std::endl; -} // ::ospray diff --git a/ospray/api/COIDeviceHost.cpp b/ospray/api/COIDeviceHost.cpp index 956576ac62..92cef5854f 100644 --- a/ospray/api/COIDeviceHost.cpp +++ b/ospray/api/COIDeviceHost.cpp @@ -741,20 +741,19 @@ namespace ospray { /*! call a renderer to render a frame buffer */ float COIDevice::renderFrame(OSPFrameBuffer _sc, - OSPRenderer _renderer, - const uint32 fbChannelFlags) + OSPRenderer _renderer, + const uint32 fbChannelFlags) { DataStream args; args.write((ObjectHandle&)_sc); args.write((ObjectHandle&)_renderer); args.write((uint32&)fbChannelFlags); float retValue = 1.0f; - callFunction(OSPCOI_RENDER_FRAME,args, &retValue, sizeof(retValue)); - callFunction(OSPCOI_RENDER_FRAME_SYNC,args,nullptr,true); + callFunction(OSPCOI_RENDER_FRAME, args, &retValue, sizeof(retValue)); + callFunction(OSPCOI_RENDER_FRAME_SYNC, args, nullptr, true); return retValue; } - void COIDevice::commit(OSPObject obj) { ObjectHandle handle = (ObjectHandle &)obj; @@ -1021,7 +1020,7 @@ namespace ospray { args.write((uint32)mode); args.write(channels); - Assert(mode == OSP_FB_RGBA8); + Assert(mode == OSP_FB_RGBA8 || mode == OSP_FB_SRGBA); COIFrameBuffer *fb = new COIFrameBuffer; fbList[handle] = fb; fb->hostMem = new int32[size.x*size.y]; diff --git a/ospray/api/COIDeviceWorker.cpp b/ospray/api/COIDeviceWorker.cpp index 2e39690753..944af3797a 100644 --- a/ospray/api/COIDeviceWorker.cpp +++ b/ospray/api/COIDeviceWorker.cpp @@ -39,6 +39,8 @@ using namespace std; namespace ospray { + extern RTCDevice g_embreeDevice; + namespace coi { // only used if manual buffer uploads are turned on ... @@ -69,12 +71,13 @@ namespace ospray { if (ospray::debugMode || ospray::logLevel >= 1) { std::cout << "!osp:coi: initializing device #" << deviceID - << " (" << (deviceID+1) << "/" << numDevices << ")" << std::endl; + << " (" << (deviceID+1) << "/" << numDevices << ")" + << std::endl; COIProcessProxyFlush(); } TiledLoadBalancer::instance = - new InterleavedTiledLoadBalancer(deviceID,numDevices); + new InterleavedTiledLoadBalancer(deviceID, numDevices); } COINATIVELIBEXPORT @@ -119,7 +122,8 @@ namespace ospray { +COIResultGetName(res)); if (format == OSP_STRING) - throw std::runtime_error("data arrays of strings not currently supported on coi device ..."); + throw std::runtime_error("data arrays of strings not currently " + "supported on coi device ..."); if (format == OSP_OBJECT) { ObjectHandle *in = (ObjectHandle *)bufferPtr[0]; @@ -159,7 +163,8 @@ namespace ospray { int flags = args.get(); if (ospray::debugMode) { - cout << "=======================================================" << endl; + cout << "=======================================================" + << endl; cout << "!osp:coi: done uploading data " << handle.ID() << endl; } @@ -168,7 +173,8 @@ namespace ospray { size_t size = nitems * sizeOf((OSPDataType)format); if (format == OSP_STRING) - throw std::runtime_error("data arrays of strings not currently supported on coi device ..."); + throw std::runtime_error("data arrays of strings not currently " + "supported on coi device ..."); if (format == OSP_OBJECT) { if (ospray::debugMode) COIProcessProxyFlush(); @@ -223,12 +229,15 @@ namespace ospray { int flags = args.get(); if (ospray::debugMode) { - cout << "=======================================================" << endl; + cout << "=======================================================" + << endl; cout << "!osp:coi: new (as-yet-empty) data " << handle.ID() << endl; } - if (format == OSP_STRING) - throw std::runtime_error("data arrays of strings not currently supported on coi device ..."); + if (format == OSP_STRING) { + throw std::runtime_error("data arrays of strings not currently " + "supported on coi device ..."); + } size_t size = nitems * sizeOf((OSPDataType)format); void *mem = new char[size]; @@ -279,9 +288,11 @@ namespace ospray { = (FrameBuffer::ColorBufferFormat)mode; bool hasDepthBuffer = (channels & OSP_FB_DEPTH)!=0; bool hasAccumBuffer = (channels & OSP_FB_ACCUM)!=0; + bool hasVarianceBuffer = (channels & OSP_FB_VARIANCE)!=0; FrameBuffer *fb = new LocalFrameBuffer(size,colorBufferFormat, hasDepthBuffer,hasAccumBuffer, + hasVarianceBuffer, pixelArray); handle.assign(fb); @@ -356,9 +367,11 @@ namespace ospray { DataStream args(argsPtr); ObjectHandle handle = args.get(); const char *type = args.getString(); - cout << "!osp:coi: new transfer function " << handle.ID() << " " << type << endl; + cout << "!osp:coi: new transfer function " << handle.ID() + << " " << type << endl; - TransferFunction *transferFunction = TransferFunction::createInstance(type); + TransferFunction *transferFunction = + TransferFunction::createInstance(type); handle.assign(transferFunction); if (ospray::debugMode) COIProcessProxyFlush(); @@ -468,7 +481,9 @@ namespace ospray { Assert(worldCoordinatesData); float *results = NULL; - volume->computeSamples(&results, (const vec3f *)worldCoordinatesData->data, worldCoordinatesData->numItems); + volume->computeSamples(&results, + (const vec3f *)worldCoordinatesData->data, + worldCoordinatesData->numItems); Assert(results); memcpy(retVal, results, retValSize); @@ -526,7 +541,10 @@ namespace ospray { COIBufferAddRef(bufferPtr[0]); - Texture2D *tx = Texture2D::createTexture(size, (OSPTextureFormat)type, bufferPtr[0], flags); + Texture2D *tx = Texture2D::createTexture(size, + (OSPTextureFormat)type, + bufferPtr[0], + flags); handle.assign(tx); if (ospray::debugMode) COIProcessProxyFlush(); @@ -665,7 +683,9 @@ namespace ospray { GeometryLocator locator; locator.ptr = geometry; - Model::GeometryVector::iterator it = std::find_if(model->geometry.begin(), model->geometry.end(), locator); + Model::GeometryVector::iterator it = + std::find_if(model->geometry.begin(), + model->geometry.end(), locator); if(it != model->geometry.end()) { model->geometry.erase(it); } @@ -699,7 +719,8 @@ namespace ospray { VolumeLocator locator; locator.ptr = volume; - Model::VolumeVector::iterator it = std::find_if(model->volume.begin(), model->volume.end(), locator); + Model::VolumeVector::iterator it = + std::find_if(model->volume.begin(), model->volume.end(), locator); if(it != model->volume.end()) { model->volume.erase(it); } @@ -717,12 +738,12 @@ namespace ospray { uint16_t retValSize) { DataStream args(argsPtr); - ObjectHandle _fb = args.get(); + ObjectHandle _fb = args.get(); ObjectHandle renderer = args.get(); uint32 channelFlags = args.get(); FrameBuffer *fb = (FrameBuffer*)_fb.lookup(); Renderer *r = (Renderer*)renderer.lookup(); - float v = r->renderFrame(fb,channelFlags); + float v = r->renderFrame(fb, channelFlags); memcpy(retVal, &v, retValSize); } @@ -833,7 +854,8 @@ namespace ospray { Data *data = (Data *) stream.get().lookup(); int *result = (int *) retVal; result[0] = true; memcpy(&result[1], &data->numItems, sizeof(size_t)); - memcpy((char *)(&result[1]) + sizeof(size_t), &data->type, sizeof(OSPDataType)); + memcpy((char *)(&result[1]) + sizeof(size_t), + &data->type, sizeof(OSPDataType)); } @@ -847,7 +869,8 @@ namespace ospray { uint16_t retValSize) { - //! The size of ReturnValue is larger than that indicated by the following definition. + //! The size of ReturnValue is larger than that indicated by the + // following definition. DataStream stream(argsPtr); ManagedObject *object = stream.get().lookup(); int *result = (int *) retVal; result[0] = true; @@ -855,7 +878,8 @@ namespace ospray { for (size_t i=0, offset=0 ; i < object->paramList.size() ; i++) { size_t size = strlen(object->paramList[i]->name) + 1; - memcpy((char *)(&result[1]) + offset, object->paramList[i]->name, size); + memcpy((char *)(&result[1]) + offset, + object->paramList[i]->name, size); offset += size; } @@ -877,7 +901,8 @@ namespace ospray { int *result = (int *) retVal; result[0] = true; int size = 0; - for (size_t i=0 ; i < object->paramList.size() ; i++) size += (strlen(object->paramList[i]->name) + 1) * sizeof(char); + for (size_t i = 0; i < object->paramList.size(); i++) + size += (strlen(object->paramList[i]->name) + 1) * sizeof(char); memcpy(&result[1], &size, sizeof(int)); } @@ -901,14 +926,20 @@ namespace ospray { case 0: { OSPDataType type = object->managedObjectType; - result[0] = true; memcpy(&result[1], &type, sizeof(OSPDataType)); break; + result[0] = true; + memcpy(&result[1], &type, sizeof(OSPDataType)); + break; } default: { ManagedObject::Param *param = object->findParam(name); if (param == NULL) return; - OSPDataType type = (param->type == OSP_OBJECT) ? param->ptr->managedObjectType : param->type; - result[0] = true; memcpy(&result[1], &type, sizeof(OSPDataType)); break; + OSPDataType type = + (param->type == OSP_OBJECT) ? param->ptr->managedObjectType : + param->type; + result[0] = true; + memcpy(&result[1], &type, sizeof(OSPDataType)); + break; } } @@ -934,9 +965,13 @@ namespace ospray { switch (type) { case OSP_DATA: { - if (param == NULL || param->type != OSP_OBJECT || param->ptr->managedObjectType != OSP_DATA) return; + if (param == NULL || + param->type != OSP_OBJECT || + param->ptr->managedObjectType != OSP_DATA) return; ObjectHandle handle = ObjectHandle::lookup(param->ptr); - result[0] = true; memcpy(&result[1], &handle, sizeof(ObjectHandle)); break; + result[0] = true; + memcpy(&result[1], &handle, sizeof(ObjectHandle)); + break; } case OSP_FLOAT: { @@ -976,21 +1011,29 @@ namespace ospray { } case OSP_MATERIAL: { - if (object->managedObjectType != OSP_GEOMETRY || ((Geometry *) object)->getMaterial() == NULL) return; - ObjectHandle handle = ObjectHandle::lookup(((Geometry *) object)->getMaterial()); - result[0] = true; memcpy(&result[1], &handle, sizeof(ObjectHandle)); break; + if (object->managedObjectType != OSP_GEOMETRY || + ((Geometry *) object)->getMaterial() == NULL) return; + ObjectHandle handle = + ObjectHandle::lookup(((Geometry *) object)->getMaterial()); + result[0] = true; + memcpy(&result[1], &handle, sizeof(ObjectHandle)); + break; } case OSP_OBJECT: { if (param == NULL || param->type != OSP_OBJECT) return; ObjectHandle handle = ObjectHandle::lookup(param->ptr); - result[0] = true; memcpy(&result[1], &handle, sizeof(ObjectHandle)); break; + result[0] = true; + memcpy(&result[1], &handle, sizeof(ObjectHandle)); + break; } case OSP_STRING: { if (param == NULL || param->type != OSP_STRING) return; const char *value = param->s; - result[0] = true; memcpy(&result[1], value, strnlen(value, retValSize - 1) + 1); break; + result[0] = true; + memcpy(&result[1], value, strnlen(value, retValSize - 1) + 1); + break; } default: return; @@ -1000,6 +1043,13 @@ namespace ospray { } // ::ospray::coi } // ::ospray +void embreeErrorFunc(const RTCError code, const char* str) +{ + std::cerr << "#osp: embree internal error " << code << " : " << str + << std::endl; + throw std::runtime_error("embree internal error '" + std::string(str) + "'"); +} + int main(int ac, const char **av) { ospray::init(&ac,&av); @@ -1012,14 +1062,20 @@ int main(int ac, const char **av) std::stringstream embreeConfig; embreeConfig << "verbose=" << ospray::logLevel; if (ospray::debugMode) - embreeConfig << ",threads=1"; + embreeConfig << " threads=1,verbose=2"; else if(ospray::numThreads > 0) embreeConfig << " threads=" << ospray::numThreads; - rtcInit(embreeConfig.str().c_str()); - //rtcInit("verbose=2,traverser=single,threads=1"); - //rtcInit("verbose=2,traverser=chunk"); + ospray::g_embreeDevice = rtcNewDevice(embreeConfig.str().c_str()); + + rtcDeviceSetErrorFunction(ospray::g_embreeDevice, embreeErrorFunc); + RTCError erc = rtcDeviceGetError(ospray::g_embreeDevice); + if (erc != RTC_NO_ERROR) { + // why did the error function not get called !? + std::cerr << "#osp:init: embree internal error number " << (int)erc + << std::endl; + assert(erc == RTC_NO_ERROR); + } - assert(rtcGetError() == RTC_NO_ERROR); ospray::TiledLoadBalancer::instance = NULL; COIPipelineStartExecutingRunFunctions(); diff --git a/ospray/api/LocalDevice.cpp b/ospray/api/LocalDevice.cpp index 947caa9d85..d341bb7b46 100644 --- a/ospray/api/LocalDevice.cpp +++ b/ospray/api/LocalDevice.cpp @@ -39,8 +39,9 @@ namespace ospray { void embreeErrorFunc(const RTCError code, const char* str) { - std::cerr << "#osp: embree internal error " << code << " : " << str << std::endl; - throw std::runtime_error("embree internal error '"+std::string(str)+"'"); + std::cerr << "#osp: embree internal error " << code << " : " << str + << std::endl; + throw std::runtime_error("embree internal error '" +std::string(str)+"'"); } LocalDevice::LocalDevice(int *_ac, const char **_av) @@ -66,7 +67,8 @@ namespace ospray { RTCError erc = rtcDeviceGetError(g_embreeDevice); if (erc != RTC_NO_ERROR) { // why did the error function not get called !? - std::cerr << "#osp:init: embree internal error number " << (int)erc << std::endl; + std::cerr << "#osp:init: embree internal error number " << (int)erc + << std::endl; assert(erc == RTC_NO_ERROR); } @@ -654,31 +656,26 @@ namespace ospray { /*! call a renderer to render a frame buffer */ float LocalDevice::renderFrame(OSPFrameBuffer _fb, - OSPRenderer _renderer, - const uint32 fbChannelFlags) + OSPRenderer _renderer, + const uint32 fbChannelFlags) { - FrameBuffer *fb = (FrameBuffer *)_fb; - // SwapChain *sc = (SwapChain *)_sc; - Renderer *renderer = (Renderer *)_renderer; - // Model *model = (Model *)_model; + FrameBuffer *fb = (FrameBuffer *)_fb; + Renderer *renderer = (Renderer *)_renderer; Assert(fb != NULL && "invalid frame buffer handle"); - // Assert(sc != NULL && "invalid frame buffer handle"); Assert(renderer != NULL && "invalid renderer handle"); - // FrameBuffer *fb = sc->getBackBuffer(); try { - return renderer->renderFrame(fb,fbChannelFlags); - } catch (std::runtime_error e) { - std::cerr << "=======================================================" << std::endl; - std::cerr << "# >>> ospray fatal error <<< " << std::endl << e.what() << std::endl; - std::cerr << "=======================================================" << std::endl; + return renderer->renderFrame(fb, fbChannelFlags); + } catch (const std::runtime_error &e) { + std::cerr << "=======================================================" + << std::endl; + std::cerr << "# >>> ospray fatal error <<< " << std::endl << e.what() + << std::endl; + std::cerr << "=======================================================" + << std::endl; exit(1); } - // WARNING: I'm doing an *im*plicit swapbuffers here at the end - // of renderframe, but to be more opengl-conform we should - // actually have the user call an *ex*plicit ospSwapBuffers call... - // sc->advance(); } //! release (i.e., reduce refcount of) given object @@ -706,7 +703,8 @@ namespace ospray { geometry->setMaterial(material); } - OSPPickResult LocalDevice::pick(OSPRenderer _renderer, const vec2f &screenPos) + OSPPickResult LocalDevice::pick(OSPRenderer _renderer, + const vec2f &screenPos) { Assert(_renderer != NULL && "invalid renderer handle"); Renderer *renderer = (Renderer*)_renderer; @@ -714,7 +712,10 @@ namespace ospray { return renderer->pick(screenPos); } - void LocalDevice::sampleVolume(float **results, OSPVolume _volume, const vec3f *worldCoordinates, const size_t &count) + void LocalDevice::sampleVolume(float **results, + OSPVolume _volume, + const vec3f *worldCoordinates, + const size_t &count) { Volume *volume = (Volume *)_volume; diff --git a/ospray/common/ISPC_KNC_Backend.h b/ospray/common/ISPC_KNC_Backend.h index 389c9ac15f..5c3faa8a1e 100644 --- a/ospray/common/ISPC_KNC_Backend.h +++ b/ospray/common/ISPC_KNC_Backend.h @@ -3013,15 +3013,15 @@ static FORCEINLINE __vec16_i32 __masked_load_i32(void *p, __vec16_i1 mask) { } static FORCEINLINE __vec16_f __masked_load_float(void *p, __vec16_i1 mask) { -#ifdef ISPC_FORCE_ALIGNED_MEMORY - return _mm512_mask_load_ps(_mm512_undefined_ps(), mask,p); -#else +// #ifdef ISPC_FORCE_ALIGNED_MEMORY +// return _mm512_mask_load_ps(_mm512_undefined_ps(), mask,p); +// #else __vec16_f tmp; tmp.v = _mm512_mask_extloadunpacklo_ps(tmp.v, 0xFFFF, p, _MM_UPCONV_PS_NONE, _MM_HINT_NONE); tmp.v = _mm512_mask_extloadunpackhi_ps(tmp.v, 0xFFFF, (uint8_t*)p+64, _MM_UPCONV_PS_NONE, _MM_HINT_NONE); __vec16_f ret; return _mm512_mask_mov_ps(ret.v, mask, tmp.v); -#endif +// #endif } static FORCEINLINE __vec16_i64 __masked_load_i64(void *p, __vec16_i1 mask) { @@ -3072,13 +3072,13 @@ static FORCEINLINE void __masked_store_i8(void *p, const __vec16_i8 &val, __vec1 } static FORCEINLINE __vec16_i8 __masked_load_i8(void *p, __vec16_i1 mask) { -#ifdef ISPC_FORCE_ALIGNED_MEMORY - __vec16_i32 tmp = _mm512_mask_extload_epi32(_mm512_undefined_epi32(), mask, p, _MM_UPCONV_EPI32_SINT8, _MM_BROADCAST32_NONE, _MM_HINT_NONE); -#else +// #ifdef ISPC_FORCE_ALIGNED_MEMORY +// __vec16_i32 tmp = _mm512_mask_extload_epi32(_mm512_undefined_epi32(), mask, p, _MM_UPCONV_EPI32_SINT8, _MM_BROADCAST32_NONE, _MM_HINT_NONE); +// #else __vec16_i32 tmp; tmp.v = _mm512_mask_extloadunpacklo_epi32(tmp.v, 0xFFFF, p, _MM_UPCONV_EPI32_SINT8, _MM_HINT_NONE); tmp.v = _mm512_mask_extloadunpackhi_epi32(tmp.v, 0xFFFF, (uint8_t*)p+64, _MM_UPCONV_EPI32_SINT8, _MM_HINT_NONE); -#endif +// #endif __vec16_i8 ret; _mm512_extstore_epi32(&ret, tmp, _MM_DOWNCONV_EPI32_SINT8, _MM_HINT_NONE); return ret; @@ -3647,10 +3647,12 @@ static FORCEINLINE void __scatter64_i64(__vec16_i64 ptrs, __vec16_i64 val, __vec #warning "__scatter64_i64 is slow due to outdated compiler" __scatter_base_offsets64_i64(0, 1, ptrs, val, mask); #else + __vec16_i32 first8ptrs, second8ptrs; hilo2zmm(ptrs, first8ptrs.v, second8ptrs.v); __vec16_i32 first8vals, second8vals; hilo2zmm(val, first8vals.v, second8vals.v); + _mm512_mask_i64extscatter_epi64 (0, mask, first8ptrs, first8vals, _MM_DOWNCONV_EPI64_NONE, 1, _MM_HINT_NONE); const __mmask8 mask8 = 0x00FF & (mask >> 8); _mm512_mask_i64extscatter_epi64 (0, mask8, second8ptrs, second8vals, _MM_DOWNCONV_EPI64_NONE, 1, _MM_HINT_NONE); diff --git a/ospray/common/OSPCommon.h b/ospray/common/OSPCommon.h index c2757f0aed..2c7610975a 100644 --- a/ospray/common/OSPCommon.h +++ b/ospray/common/OSPCommon.h @@ -105,6 +105,31 @@ namespace ospray { #pragma warning(disable:177 ) // variable declared but was never referenced #endif +namespace embree { + void* alignedMalloc(size_t size, size_t align); + void alignedFree(void* ptr); +} +#define ALIGNED_STRUCT \ + void* operator new(size_t size) { return alignedMalloc(size); } \ + void operator delete(void* ptr) { alignedFree(ptr); } \ + void* operator new[](size_t size) { return alignedMalloc(size); } \ + void operator delete[](void* ptr) { alignedFree(ptr); } \ + +#define ALIGNED_STRUCT_(align) \ + void* operator new(size_t size) { return alignedMalloc(size,align); } \ + void operator delete(void* ptr) { alignedFree(ptr); } \ + void* operator new[](size_t size) { return alignedMalloc(size,align); } \ + void operator delete[](void* ptr) { alignedFree(ptr); } \ + +// #if defined(__MIC__) +// #pragma message("using aligned opeartor new (this is knc, right!?)...") +// void* operator new(size_t size) { return embree::alignedMalloc(size); } +// void operator delete(void* ptr) { embree::alignedFree(ptr); } +// void* operator new[](size_t size) throws { return embree::alignedMalloc(size); } +// void operator delete[](void* ptr) { embree::alignedFree(ptr); } +// #endif + + //! main namespace for all things ospray (for internal code) namespace ospray { diff --git a/ospray/common/ObjectHandle.cpp b/ospray/common/ObjectHandle.cpp index b03dd78120..784f1518e0 100644 --- a/ospray/common/ObjectHandle.cpp +++ b/ospray/common/ObjectHandle.cpp @@ -47,26 +47,28 @@ namespace ospray { } /*! define the given handle to refer to given object */ - void ObjectHandle::assign(const ObjectHandle &handle, const ManagedObject *object) + void ObjectHandle::assign(const ObjectHandle &handle, + const ManagedObject *object) { objectByHandle[handle] = (ManagedObject*)object; } + void ObjectHandle::assign(const ManagedObject *object) const { objectByHandle[*this] = (ManagedObject*)object; } + void ObjectHandle::freeObject() const { - std::map >::iterator it = - objectByHandle.find(i64); + auto it = objectByHandle.find(i64); Assert(it != objectByHandle.end()); it->second = NULL; objectByHandle.erase(it); } + bool ObjectHandle::defined() const { - std::map >::const_iterator it = - objectByHandle.find(i64); + auto it = objectByHandle.find(i64); return it != objectByHandle.end(); } @@ -74,18 +76,18 @@ namespace ospray { { if (i64 == 0) return NULL; - std::map >::const_iterator it = - objectByHandle.find(i64); + auto it = objectByHandle.find(i64); Assert(it != objectByHandle.end()); return it->second.ptr; } - ObjectHandle ObjectHandle::lookup(ManagedObject *object) { + ObjectHandle ObjectHandle::lookup(ManagedObject *object) + { + for (auto it = objectByHandle.begin(); it != objectByHandle.end(); it++) { + if (it->second.ptr == object) return(ObjectHandle(it->first)); + } - std::map >::const_iterator it; - for (it = objectByHandle.begin() ; it != objectByHandle.end() ; it++) if (it->second.ptr == object) return(ObjectHandle(it->first)); return(nullHandle); - } const ObjectHandle ObjectHandle::nullHandle(0); diff --git a/ospray/common/tasking/parallel_for.h b/ospray/common/tasking/parallel_for.h index 41e5caf8fb..8869be195e 100644 --- a/ospray/common/tasking/parallel_for.h +++ b/ospray/common/tasking/parallel_for.h @@ -65,4 +65,20 @@ inline void parallel_for(int nTasks, const TASK_T& fcn) #endif } +// NOTE(jda) - Allow serial version of parallel_for() without the need to change +// the entire tasking system backend (which can trigger rebuild of +// Embree). +template +inline void serial_for(int nTasks, const TASK_T& fcn) +{ + static_assert(has_operator_method_with_integral_param::value, + "ospray::serial_for() requires the implementation of method " + "'void TASK_T::operator(P taskIndex), where P is of type " + "short, int, uint, or size_t."); + + for (int taskIndex = 0; taskIndex < nTasks; ++taskIndex) { + fcn(taskIndex); + } +} + }//namespace ospray diff --git a/ospray/fb/LocalFB.cpp b/ospray/fb/LocalFB.cpp index 0342019f25..f501981ca0 100644 --- a/ospray/fb/LocalFB.cpp +++ b/ospray/fb/LocalFB.cpp @@ -26,7 +26,8 @@ namespace ospray { bool hasAccumBuffer, bool hasVarianceBuffer, void *colorBufferToUse) - : FrameBuffer(size, colorBufferFormat, hasDepthBuffer, hasAccumBuffer, hasVarianceBuffer) + : FrameBuffer(size, colorBufferFormat, hasDepthBuffer, + hasAccumBuffer, hasVarianceBuffer) { Assert(size.x > 0); Assert(size.y > 0); @@ -39,10 +40,10 @@ namespace ospray { break; case OSP_FB_RGBA8: case OSP_FB_SRGBA: - colorBuffer = (vec4f*)alignedMalloc(sizeof(vec4f)*size.x*size.y); + colorBuffer = (uint32*)alignedMalloc(sizeof(uint32)*size.x*size.y); break; case OSP_FB_RGBA32F: - colorBuffer = (uint32*)alignedMalloc(sizeof(uint32)*size.x*size.y); + colorBuffer = (vec4f*)alignedMalloc(sizeof(vec4f)*size.x*size.y); break; default: throw std::runtime_error("color buffer format not supported"); @@ -61,12 +62,12 @@ namespace ospray { tilesx = divRoundUp(size.x, TILE_SIZE); tiles = tilesx * divRoundUp(size.y, TILE_SIZE); - tileAccumID = new int32[tiles]; + tileAccumID = (int32*)alignedMalloc(sizeof(int32)*tiles); memset(tileAccumID, 0, tiles*sizeof(int32)); if (hasVarianceBuffer) { varianceBuffer = (vec4f*)alignedMalloc(sizeof(vec4f)*size.x*size.y); - tileErrorBuffer = new float[tiles]; + tileErrorBuffer = (float*)alignedMalloc(sizeof(float)*tiles); // maximum number of regions: all regions are of size 3 are split in half errorRegion.reserve(divRoundUp(tiles*2, 3)); } else { @@ -90,8 +91,8 @@ namespace ospray { alignedFree(colorBuffer); alignedFree(accumBuffer); alignedFree(varianceBuffer); - delete[] tileAccumID; - delete[] tileErrorBuffer; + alignedFree(tileAccumID); + alignedFree(tileErrorBuffer); } std::string LocalFrameBuffer::toString() const @@ -114,7 +115,9 @@ namespace ospray { errorRegion.clear(); // initially create one region covering the complete image - errorRegion.push_back(box2i(vec2i(0), vec2i(tilesx, divRoundUp(size.y, TILE_SIZE)))); + errorRegion.push_back(box2i(vec2i(0), + vec2i(tilesx, + divRoundUp(size.y, TILE_SIZE)))); } } } @@ -170,7 +173,8 @@ namespace ospray { err += tileErrorBuffer[idx]; maxErr = std::max(maxErr, tileErrorBuffer[idx]); } - // set all tiles of this region to local max error to enforce their refinement as a group + // set all tiles of this region to local max error to enforce their + // refinement as a group for (int y = region.lower.y; y < region.upper.y; y++) for (int x = region.lower.x; x < region.upper.x; x++) { int idx = y * tilesx + x; @@ -188,8 +192,9 @@ namespace ospray { i--; continue; } - vec2i split = region.lower + size / 2; // TODO: find split with equal variance - errorRegion.push_back(region); // region reference might become invalid + vec2i split = region.lower + size / 2; // TODO: find split with equal + // variance + errorRegion.push_back(region); // region ref might become invalid if (size.x > size.y) { errorRegion[i].upper.x = split.x; errorRegion.back().lower.x = split.x; diff --git a/ospray/fb/Tile.h b/ospray/fb/Tile.h index a6d1d0a5ca..81529d25b3 100644 --- a/ospray/fb/Tile.h +++ b/ospray/fb/Tile.h @@ -35,6 +35,9 @@ namespace ospray { may actually use uchars, but the tile will always store floats. */ struct __aligned(64) Tile { + // make sure this tile is 64-byte aligned when alloc'ed + ALIGNED_STRUCT; + // 'red' component; in float. float r[TILE_SIZE*TILE_SIZE]; // 'green' component; in float. diff --git a/ospray/geometry/TriangleMesh.ispc b/ospray/geometry/TriangleMesh.ispc index 67aa59ac69..bb8ec8aa94 100644 --- a/ospray/geometry/TriangleMesh.ispc +++ b/ospray/geometry/TriangleMesh.ispc @@ -198,7 +198,8 @@ static void TriangleMesh_postIntersect(uniform Geometry *uniform _self, } if( self->materialList) { - dg.material = self->materialList[dg.materialID < 0 ? 0 : dg.materialID]; + Material *myMat = self->materialList[dg.materialID < 0 ? 0 : dg.materialID]; + dg.material = myMat; } } } diff --git a/ospray/mpi/DistributedFrameBuffer.cpp b/ospray/mpi/DistributedFrameBuffer.cpp index b7449631cc..36e502bbcf 100644 --- a/ospray/mpi/DistributedFrameBuffer.cpp +++ b/ospray/mpi/DistributedFrameBuffer.cpp @@ -213,7 +213,6 @@ namespace ospray { { std::vector delayedMessage; - // PING; PRINT(this); fflush(0); { LockGuard lock(mutex); DBG(printf("rank %i starting new frame\n",mpi::world.rank)); @@ -225,13 +224,9 @@ namespace ospray { if (pixelOp) pixelOp->beginFrame(); - // PING;fflush(0); - // PRINT(myTiles.size());fflush(0); for (int i=0;inewFrame(); } - // PING;fflush(0); // create a local copy of delayed tiles, so we can work on them outside // the mutex @@ -249,8 +244,6 @@ namespace ospray { // incoming WILL write into the frame buffer, composite tiles, // etc! frameIsActive = true; - - // PRINT(delayedMessage.size()); } // might actually want to move this to a thread: @@ -344,7 +337,6 @@ namespace ospray { const void *DFB::mapDepthBuffer() { - PING; fflush(0); if (!localFBonMaster) { throw std::runtime_error("#osp:mpi:dfb: tried to 'ospMap()' the depth " "buffer of a frame buffer that doesn't have a " @@ -402,7 +394,6 @@ namespace ospray { void DFB::processMessage(MasterTileMessage_RGBA_I8 *msg) { - // PING; for (int iy=0;iycoords.y; if (iiy >= numPixels.y) continue; @@ -490,14 +481,11 @@ namespace ospray { if (!frameIsActive) { // frame is not actually active, yet - put the tile into the // delayed processing buffer, and return WITHOUT deleting it. - DBG(PING); delayedMessage.push_back(_msg); return; } } - DBG(PING); - async([=]() { switch (_msg->command) { case DFB::MASTER_WRITE_TILE_NONE: @@ -514,8 +502,6 @@ namespace ospray { }; delete _msg; }); - - DBG(PING); } void DFB::closeCurrentFrame() @@ -580,7 +566,7 @@ namespace ospray { for (int i=0;ifinal.b[i] = 0.f; for (int i=0;ifinal.a[i] = 0.f; } - }); + }); if (hasAccumBuffer && (fbChannelFlags & OSP_FB_ACCUM)) accumId = -1; // we increment at the start of the frame diff --git a/ospray/mpi/DistributedFrameBuffer.h b/ospray/mpi/DistributedFrameBuffer.h index 5163fc0558..a454be268b 100644 --- a/ospray/mpi/DistributedFrameBuffer.h +++ b/ospray/mpi/DistributedFrameBuffer.h @@ -76,6 +76,8 @@ namespace ospray { necessariy 'end-begin'. 'color' and 'depth' arrays are always alloc'ed in TILE_SIZE pixels */ struct TileDesc { + ALIGNED_STRUCT; + /*! constructor */ TileDesc(DistributedFrameBuffer *dfb, const vec2i &begin, diff --git a/ospray/mpi/MPILoadBalancer.cpp b/ospray/mpi/MPILoadBalancer.cpp index b869e2f0e0..aed01191a6 100644 --- a/ospray/mpi/MPILoadBalancer.cpp +++ b/ospray/mpi/MPILoadBalancer.cpp @@ -74,6 +74,7 @@ namespace ospray { int numTiles_y = divRoundUp(fb->size.y,TILE_SIZE); const int NTASKS = numTiles_x * numTiles_y; + // serial_for(NTASKS, [&](int taskIndex){ parallel_for(NTASKS, [&](int taskIndex){ const size_t tileID = taskIndex; if ((tileID % worker.size) != worker.rank) return; @@ -83,19 +84,26 @@ namespace ospray { const vec2i tileId(tile_x, tile_y); const int32 accumID = fb->accumID(tileID); -#if TILE_SIZE>128 +#ifdef __MIC__ +# define MAX_TILE_SIZE 32 +#else +# define MAX_TILE_SIZE 128 +#endif + +#if TILE_SIZE>MAX_TILE_SIZE Tile *tilePtr = new Tile(tileId, fb->size, accumID); Tile &tile = *tilePtr; #else Tile __aligned(64) tile(tileId, fb->size, accumID); #endif + // serial_for(numJobs(tiledRenderer->spp, accumID), [&](int taskIndex){ parallel_for(numJobs(tiledRenderer->spp, accumID), [&](int taskIndex){ tiledRenderer->renderTile(perFrameData, tile, taskIndex); }); fb->setTile(tile); -#if TILE_SIZE>128 +#if TILE_SIZE>MAX_TILE_SIZE delete tilePtr; #endif }); diff --git a/ospray/mpi/worker.cpp b/ospray/mpi/worker.cpp index 5e0053d809..cb2dee6519 100644 --- a/ospray/mpi/worker.cpp +++ b/ospray/mpi/worker.cpp @@ -145,7 +145,6 @@ namespace ospray { try { while (1) { const int command = cmd.get_int32(); - // PING; PRINT(command); fflush(0); // printf("worker: got command %i\n",command); fflush(0); switch (command) { @@ -346,6 +345,7 @@ namespace ospray { const ObjectHandle handle = cmd.get_handle(); const uint32 channelFlags = cmd.get_int32(); FrameBuffer *fb = (FrameBuffer*)handle.lookup(); + assert(fb); fb->clear(channelFlags); } break; case ospray::CMD_RENDER_FRAME: { @@ -654,8 +654,8 @@ namespace ospray { const size_t size = cmd.get_size_t(); const size_t bcBufferSize = 40*1024*1024; - static void *bcBuffer = malloc(bcBufferSize); - void *mem = size < bcBufferSize ? bcBuffer : malloc(size); + static void *bcBuffer = alignedMalloc(bcBufferSize); + void *mem = size < bcBufferSize ? bcBuffer : alignedMalloc(size); // double t0 = getSysTime(); cmd.get_data(size,mem); @@ -679,7 +679,7 @@ namespace ospray { if (worker.rank == 0) MPI_Send(&sumFail,1,MPI_INT,0,0,mpi::app.comm); - if (size >= bcBufferSize) free(mem); + if (size >= bcBufferSize) alignedFree(mem); } break; // ================================================================== diff --git a/ospray/render/LoadBalancer.cpp b/ospray/render/LoadBalancer.cpp index 30642c92c9..8fa7819a26 100644 --- a/ospray/render/LoadBalancer.cpp +++ b/ospray/render/LoadBalancer.cpp @@ -61,10 +61,10 @@ namespace ospray { if (fb->tileError(tileID) <= renderer->errorThreshold) return; - Tile tile(tileID, fb->size, accumID); + Tile __aligned(64) tile(tileID, fb->size, accumID); - parallel_for(numJobs(renderer->spp, accumID), [&](int taskIndex) { - renderer->renderTile(perFrameData, tile, taskIndex); + parallel_for(numJobs(renderer->spp, accumID), [&](int tIdx) { + renderer->renderTile(perFrameData, tile, tIdx); }); fb->setTile(tile); @@ -112,13 +112,27 @@ namespace ospray { if (fb->tileError(tileID) <= renderer->errorThreshold) return; - Tile tile(tileID, fb->size, accumID); +#ifdef __MIC__ +# define MAX_TILE_SIZE 32 +#else +# define MAX_TILE_SIZE 128 +#endif + +#if TILE_SIZE>MAX_TILE_SIZE + Tile *tilePtr = new Tile(tileID, fb->size, accumID); + Tile &tile = *tilePtr; +#else + Tile __aligned(64) tile(tileID, fb->size, accumID); +#endif - parallel_for(numJobs(renderer->spp, accumID), [&](int taskIndex) { - renderer->renderTile(perFrameData, tile, taskIndex); + parallel_for(numJobs(renderer->spp, accumID), [&](int tIdx) { + renderer->renderTile(perFrameData, tile, tIdx); }); fb->setTile(tile); +#if TILE_SIZE>MAX_TILE_SIZE + delete tilePtr; +#endif }); renderer->endFrame(perFrameData,channelFlags); diff --git a/ospray/render/Renderer.ispc b/ospray/render/Renderer.ispc index 6e16e50253..aa713b82f7 100644 --- a/ospray/render/Renderer.ispc +++ b/ospray/render/Renderer.ispc @@ -92,7 +92,7 @@ unmasked void Renderer_default_renderTile(uniform Renderer *uniform self, depthTexCoord.x = (screenSample.sampleID.x + 0.5f) * fb->rcpSize.x; depthTexCoord.y = (screenSample.sampleID.y + 0.5f) * fb->rcpSize.y; - tMax = get1f(self->maxDepthTexture, depthTexCoord); + tMax = min(get1f(self->maxDepthTexture, depthTexCoord), infinity); } vec3f col = make_vec3f(0.f); const uint32 pixel = z_order.xs[index] + (z_order.ys[index] * TILE_SIZE); diff --git a/ospray/render/volume/RaycastVolumeRenderer.ispc b/ospray/render/volume/RaycastVolumeRenderer.ispc index 3512c2e4e5..c97cf1cf36 100644 --- a/ospray/render/volume/RaycastVolumeRenderer.ispc +++ b/ospray/render/volume/RaycastVolumeRenderer.ispc @@ -611,7 +611,8 @@ export void DDDVRRenderer_renderTile(void*uniform _self, depthTexCoord.x = (fgSample.sampleID.x + 0.5f) * fb->rcpSize.x; depthTexCoord.y = (fgSample.sampleID.y + 0.5f) * fb->rcpSize.y; - fgSample.ray.t = get1f(self->maxDepthTexture, depthTexCoord); + const float oldT = fgSample.ray.t; + fgSample.ray.t = max(get1f(self->maxDepthTexture, depthTexCoord),oldT); } bgSample = fgSample; diff --git a/ospray/volume/GhostBlockBrickedVolume.cpp b/ospray/volume/GhostBlockBrickedVolume.cpp index 66b8247fa0..982cc0e70a 100644 --- a/ospray/volume/GhostBlockBrickedVolume.cpp +++ b/ospray/volume/GhostBlockBrickedVolume.cpp @@ -96,6 +96,7 @@ namespace ospray { #endif // Copy voxel data into the volume. const int NTASKS = regionSize.y * regionSize.z; + parallel_for(NTASKS, [&](int taskIndex){ ispc::GBBV_setRegion(ispcEquivalent, source, diff --git a/ospray/volume/GhostBlockBrickedVolume.ispc b/ospray/volume/GhostBlockBrickedVolume.ispc index 34a7dacab4..54b706f78a 100644 --- a/ospray/volume/GhostBlockBrickedVolume.ispc +++ b/ospray/volume/GhostBlockBrickedVolume.ispc @@ -357,55 +357,58 @@ template_getVoxel(float) template_getVoxel(double) #undef template_getVoxel -#define template_setRegion(type) \ -void GBBV_setRegionTask_##type(GBBV *uniform self, \ - const void *uniform _source, \ - const uniform vec3i &targetCoord000, \ - const uniform vec3i ®ionSize, \ - const uniform int taskIndex) \ -{ \ - const type *uniform source = (const type *uniform)_source; \ - const uniform uint32 region_y = taskIndex % regionSize.y; \ - const uniform uint32 region_z = taskIndex / regionSize.y; \ - const uniform uint64 runOfs \ - = (uint64)regionSize.x * (region_y + (uint64)regionSize.y * region_z); \ - const type *uniform run = source + runOfs; \ - vec3i coord = targetCoord000 + make_vec3i(0,region_y,region_z); \ - foreach (x = 0 ... regionSize.x) { \ - Address address; \ - coord.x = targetCoord000.x + x; \ - if (coord.x < 0 || \ - coord.y < 0 || \ - coord.z < 0 || \ - coord.x >= self->super.dimensions.x || \ - coord.y >= self->super.dimensions.y || \ - coord.z >= self->super.dimensions.z \ - ) \ - continue; \ - \ - GBBV_getIndices_##type(self, coord, address); \ - /* set voxel itself */ \ - foreach_unique(blockID in address.block) { \ - type *uniform blockPtr \ - = ((type*uniform)self->blockMem) \ - + blockID * (uint64)VOXELS_PER_BLOCK; \ - blockPtr[address.voxel] = run[x]; \ - } \ - /* copy voxel to end of lower/left/front block if it's on the boundary */ \ - for (uniform int32 iz=0;iz<2;iz++) \ - for (uniform int32 iy=0;iy<2;iy++) \ - for (uniform int32 ix=0;ix<2;ix++) { \ - if (GBBV_getGhostIndices(self, coord, make_vec3i(ix,iy,iz),address)) { \ - foreach_unique(blockID in address.block) { \ - type *uniform blockPtr \ - = ((type*uniform)self->blockMem) \ - + (uint64)blockID * (uint64)VOXELS_PER_BLOCK; \ - blockPtr[address.voxel] = run[x]; \ - } \ - } \ - } \ - } \ -} +#define template_setRegion(type) \ + void GBBV_setRegionTask_##type(GBBV *uniform self, \ + const void *uniform _source, \ + const uniform vec3i &targetCoord000, \ + const uniform vec3i ®ionSize, \ + const uniform int taskIndex) \ + { \ + const type *uniform source = (const type *uniform)_source; \ + const uniform uint32 region_y = taskIndex % regionSize.y; \ + const uniform uint32 region_z = taskIndex / regionSize.y; \ + const uniform uint64 runOfs \ + = (uint64)regionSize.x \ + * (region_y + (uint64)regionSize.y * region_z); \ + const type *uniform run = source + runOfs; \ + \ + vec3i coord = targetCoord000 + make_vec3i(0,region_y,region_z); \ + foreach (x = 0 ... regionSize.x) { \ + Address address; \ + coord.x = targetCoord000.x + x; \ + if (coord.x < 0 || \ + coord.y < 0 || \ + coord.z < 0 || \ + coord.x >= self->super.dimensions.x || \ + coord.y >= self->super.dimensions.y || \ + coord.z >= self->super.dimensions.z \ + ) \ + continue; \ + \ + GBBV_getIndices_##type(self, coord, address); \ + /* set voxel itself */ \ + foreach_unique(blockID in address.block) { \ + type *uniform blockPtr \ + = ((type*uniform)self->blockMem) \ + + blockID * (uint64)VOXELS_PER_BLOCK; \ + blockPtr[address.voxel] = run[x]; \ + } \ + /* copy voxel to end of lower/left/front block if it's on the boundary */ \ + for (uniform int32 iz=0;iz<2;iz++) \ + for (uniform int32 iy=0;iy<2;iy++) \ + for (uniform int32 ix=0;ix<2;ix++) { \ + if (GBBV_getGhostIndices(self, coord, \ + make_vec3i(ix,iy,iz),address)) { \ + foreach_unique(blockID in address.block) { \ + type *uniform blockPtr \ + = ((type*uniform)self->blockMem) \ + + (uint64)blockID * (uint64)VOXELS_PER_BLOCK; \ + blockPtr[address.voxel] = run[x]; \ + } \ + } \ + } \ + } \ + } template_setRegion(uint8) template_setRegion(uint16) diff --git a/scripts/release/linux.sh b/scripts/release/linux.sh index 7e9440c6ca..d1e7e42f96 100755 --- a/scripts/release/linux.sh +++ b/scripts/release/linux.sh @@ -41,12 +41,15 @@ function check_symbols #### Set variables for script #### -export ROOT_DIR=$PWD +ROOT_DIR=$PWD +DEP_DIR=$ROOT_DIR/deps + +DEP_LOCATION=http://sdvis.org/ospray/download/dependencies/linux +DEP_EMBREE=embree_dynamic-2.9.0.x86_64.linux +DEP_ISPC=ispc-v1.9.0-linux +DEP_TBB=tbb44_20160413oss +DEP_TARBALLS="$DEP_EMBREE.tar.gz $DEP_ISPC.tar.gz ${DEP_TBB}_lin.tgz" -DEP_LOCATION=http://sdvis.org/~jdamstut/ospray_deps/linux -EMBREE_TARBALL=embree-2.9.0.x86_64.linux.tar.gz -ISPC_TARBALL=ispc-v1.9.0-linux.tar.gz -TBB_TARBALL=tbb44_20160413oss_lin.tgz # set compiler if the user hasn't explicitly set CC and CXX if [ -z $CC ]; then @@ -68,35 +71,16 @@ fi #### Fetch dependencies (TBB+Embree+ISPC) #### -if [ ! -d deps ]; then - mkdir deps - rm -rf deps/* - cd deps - - # Embree - wget $DEP_LOCATION/$EMBREE_TARBALL - tar -xaf $EMBREE_TARBALL - rm $EMBREE_TARBALL - - # ISPC - wget $DEP_LOCATION/$ISPC_TARBALL - tar -xaf $ISPC_TARBALL - rm $ISPC_TARBALL - - # TBB - wget $DEP_LOCATION/$TBB_TARBALL - tar -xaf $TBB_TARBALL - rm $TBB_TARBALL - - cd $ROOT_DIR - ln -snf deps/embree* embree - ln -snf deps/ispc* ispc - ln -snf deps/tbb* tbb -fi +mkdir -p $DEP_DIR +cd $DEP_DIR -TBB_PATH_LOCAL=$ROOT_DIR/tbb -export embree_DIR=$ROOT_DIR/embree -export PATH=$ROOT_DIR/ispc:$PATH +for dep in $DEP_TARBALLS ; do + wget --progress=dot:mega -c $DEP_LOCATION/$dep + tar -xaf $dep +done +export embree_DIR=$DEP_DIR/$DEP_EMBREE + +cd $ROOT_DIR #### Build OSPRay #### @@ -106,17 +90,20 @@ cd build_release # Clean out build directory to be sure we are doing a fresh build rm -rf * + # set release and RPM settings cmake \ -D OSPRAY_BUILD_ISA=ALL \ +-D OSPRAY_BUILD_ENABLE_KNL=ON \ -D OSPRAY_BUILD_MIC_SUPPORT=OFF \ -D OSPRAY_BUILD_COI_DEVICE=OFF \ -D OSPRAY_BUILD_MPI_DEVICE=OFF \ -D OSPRAY_USE_EXTERNAL_EMBREE=ON \ +-D TBB_ROOT=$DEP_DIR/$DEP_TBB \ +-D ISPC_EXECUTABLE=$DEP_DIR/$DEP_ISPC/ispc \ -D USE_IMAGE_MAGICK=OFF \ -D OSPRAY_ZIP_MODE=OFF \ -D CMAKE_INSTALL_PREFIX=/usr \ --D TBB_ROOT=$TBB_PATH_LOCAL \ .. # create RPM files diff --git a/scripts/release/macosx.sh b/scripts/release/macosx.sh index 65a2359239..34b150b3cd 100755 --- a/scripts/release/macosx.sh +++ b/scripts/release/macosx.sh @@ -27,12 +27,15 @@ umask 002 #### Set variables for script #### -export ROOT_DIR=$PWD +ROOT_DIR=$PWD +DEP_DIR=$ROOT_DIR/deps + +DEP_LOCATION=http://sdvis.org/ospray/download/dependencies/osx +DEP_EMBREE=embree-2.9.0.x86_64.macosx +DEP_ISPC=ispc-v1.9.0-osx +DEP_TBB=tbb44_20160413oss +DEP_TARBALLS="$DEP_EMBREE.tar.gz $DEP_ISPC.tar.gz ${DEP_TBB}_osx.tgz" -DEP_LOCATION=http://sdvis.org/~jdamstut/ospray_deps/osx -EMBREE_TARBALL=embree-2.9.0.x86_64.macosx.tar.gz -ISPC_TARBALL=ispc-v1.9.0-osx.tar.gz -TBB_TARBALL=tbb44_20160413oss_osx.tgz # set compiler if the user hasn't explicitly set CC and CXX if [ -z $CC ]; then @@ -51,35 +54,16 @@ TBB_PATH_LOCAL=$PWD/tbb #### Fetch dependencies (TBB+Embree+ISPC) #### -if [ ! -d deps ]; then - mkdir deps - rm -rf deps/* - cd deps - - # Embree - wget $DEP_LOCATION/$EMBREE_TARBALL - tar -xf $EMBREE_TARBALL - rm $EMBREE_TARBALL - - # ISPC - wget $DEP_LOCATION/$ISPC_TARBALL - tar -xf $ISPC_TARBALL - rm $ISPC_TARBALL - - # TBB - wget $DEP_LOCATION/$TBB_TARBALL - tar -xf $TBB_TARBALL - rm $TBB_TARBALL - - cd $ROOT_DIR - ln -snf deps/embree* embree - ln -snf deps/ispc* ispc - ln -snf deps/tbb* tbb -fi +mkdir -p $DEP_DIR +cd $DEP_DIR -TBB_PATH_LOCAL=$ROOT_DIR/tbb -export embree_DIR=$ROOT_DIR/embree -export PATH=$ROOT_DIR/ispc:$PATH +for dep in $DEP_TARBALLS ; do + wget --progress=dot:mega -c $DEP_LOCATION/$dep + tar -xf $dep +done +export embree_DIR=$DEP_DIR/$DEP_EMBREE + +cd $ROOT_DIR #### Build OSPRay #### @@ -89,12 +73,16 @@ cd build_release # Clean out build directory to be sure we are doing a fresh build rm -rf * + # set release and installer settings cmake \ -D OSPRAY_BUILD_ISA=ALL \ -D OSPRAY_BUILD_MIC_SUPPORT=OFF \ -D OSPRAY_BUILD_COI_DEVICE=OFF \ -D OSPRAY_BUILD_MPI_DEVICE=OFF \ +-D OSPRAY_USE_EXTERNAL_EMBREE=ON \ +-D TBB_ROOT=$DEP_DIR/$DEP_TBB \ +-D ISPC_EXECUTABLE=$DEP_DIR/$DEP_ISPC/ispc \ -D USE_IMAGE_MAGICK=OFF \ -D OSPRAY_ZIP_MODE=OFF \ -D CMAKE_INSTALL_PREFIX=/opt/local \ @@ -102,7 +90,6 @@ cmake \ -D CMAKE_INSTALL_LIBDIR=lib \ -D CMAKE_INSTALL_DOCDIR=../../Applications/OSPRay/doc \ -D CMAKE_INSTALL_BINDIR=../../Applications/OSPRay/bin \ --D TBB_ROOT=$TBB_PATH_LOCAL \ .. # create installers @@ -115,7 +102,6 @@ cmake \ -D CMAKE_INSTALL_LIBDIR=lib \ -D CMAKE_INSTALL_DOCDIR=doc \ -D CMAKE_INSTALL_BINDIR=bin \ --D TBB_ROOT=$TBB_PATH_LOCAL \ .. # create ZIP files diff --git a/scripts/release/win.sh b/scripts/release/win.sh index 0d27a32f42..66d5260ecc 100755 --- a/scripts/release/win.sh +++ b/scripts/release/win.sh @@ -20,7 +20,6 @@ export CPATH= export LIBRARY_PATH= export LD_LIBRARY_PATH= -#TBB_PATH_LOCAL=$PWD/tbb mkdir -p build_release cd build_release