Ejemplo n.º 1
0
/**
 * \brief Initialization function of measure function
 *        measure_MPI_IO_read_file_once().
 *
 * Only one process is active. It reads once from a file.
 *
 * Remark:<br>
 * With the <tt>O_DIRECT</tt> flag set, cache effects are minimized, because I/O
 * is done directly to/from user space buffers. The operation system's page
 * cache is bypassed. Under Linux 2.6 alignment to 512-byte boundaries is
 * required for buffer and file offset. Thus the following parameters should be
 * set in a SKaMPI input file:
 * - <tt>set_send_buffert_alignment (512)</tt>
 * - <tt>set_recv_buffert_alignment (512)</tt>
 * - <tt>switch_buffer_cycling_off ()</tt><br>
 *
 * <tt>O_DIRECT</tt> is only relevant if the POSIX-API is used for I/O.
 * 
 * For more information please refer to the <tt>open ()</tt> man pages.
 * 
 * \param[in] size          size of memory buffer, i.e. number of <tt>MPI_BYTE</tt>s
 * \param[in] api           POSIX-API or MPI-API for I/O accesses
 * \param[in] directio_flag open file with <tt>O_DIRECT</tt> flag to minimize
 *                          cache effects
 *
 * \return    void
 */
void init_MPI_IO_read_file_once (int size, char *api, int directio_flag) {
  char *send_buffer;

  assert (size > 0);

  io_filename = get_io_filename (IO_FILENAME, 0);

  if (get_measurement_rank () == 0){

    send_buffer = mpi_malloc_chars (get_extent (size, MPI_BYTE));

    MPI_File_open (MPI_COMM_SELF, io_filename,
		   MPI_MODE_WRONLY | MPI_MODE_CREATE | MPI_MODE_UNIQUE_OPEN,
		   MPI_INFO_NULL, &io_fh);
    MPI_File_set_view (io_fh, (MPI_Offset)0, 
		       MPI_BYTE, MPI_BYTE,
		       "native", MPI_INFO_NULL);
    MPI_File_write (io_fh, send_buffer, size, MPI_BYTE, MPI_STATUS_IGNORE);
    MPI_File_close (&io_fh);
    mpi_free (send_buffer);

    set_recv_buffer_usage (size);
    set_reported_message_size (size);
  }

  MPI_Barrier (get_measurement_comm ());

  /* set synchronization type:
   SYNC_BARRIER if all SKaMPI processes run on one physical processor 
   SYNC_REAL if every SKaMPI process runs on its own physical processor */
  set_synchronization (SYNC_REAL);

  init_synchronization ();
}
Ejemplo n.º 2
0
/**
 * \brief Initialization function of measure function
 *        measure_MPI_IO_write_large_file_once().
 *
 * Only one process is active. It writes once to a file.
 *
 * Since SKaMPI measurement functions are not allowed to use MPI_Offset
 * parameters, it is impossible to tell an init_-routine to create a file
 * which is larger than \f$2^{\mbox{\texttt{sizeof(int)}}-1}-1\f$ directly. As
 * a preliminary solution we use a parameter (<tt>power</tt>) which commits the
 * power to 2 as an indicator for the file size.
 *
 * Remark concerning the <em>HP XC6000</em>:<br>
 * Measurements showed that there is no significant difference between MPI-API
 * and POSIX-API I/O accesses, if files are larger than 1MB. Thus there is no
 * choice between these two modes like in measure_MPI_IO_read_file_once(),
 * which makes type compatibilty problems much easier. Only MPI-API is
 * supported.
 * 
 * \param[in] power       size of memory buffer; 2 to the power of `power' <tt>MPI_BYTE</tt>s
 * \param[in] create_flag write into existing file (FALSE) or create it (TRUE)
 *
 * \return    void
 */
void init_MPI_IO_write_large_file_once (int power, int create_flag) {
  MPI_Offset size;
  char       *error_string;

  io_filename = get_io_filename (IO_FILENAME, 0);

  if (get_measurement_rank () == 0){

    if (power > MAXIMUM_POWER || power < 0){
      error_string = strerror (EINVAL);
      error_with_abort (errno,
			"\ninit_MPI_IO_write_large_file_once (int %d, int %d) failed."
			"\nInvalid power argument."
			"\nError: %s\n",
			power, create_flag, error_string);
    }

    size = ((MPI_Offset) 1) << power;

    if (create_flag == 0){
    
      MPI_File_open (MPI_COMM_SELF, io_filename,
		     MPI_MODE_WRONLY | MPI_MODE_CREATE | MPI_MODE_UNIQUE_OPEN,
		     MPI_INFO_NULL, &io_fh);
      MPI_File_preallocate (io_fh, size);
      MPI_File_close (&io_fh);
    }
    
    set_send_buffer_usage (size);
    set_reported_message_size (size);
  }

  MPI_Barrier (get_measurement_comm ());

  /* set synchronization type:
   SYNC_BARRIER if all SKaMPI processes run on one physical processor 
   SYNC_REAL if every SKaMPI process runs on its own physical processor */
  set_synchronization (SYNC_REAL);

  init_synchronization ();
}
Ejemplo n.º 3
0
void display_reset(int samples, bool vsync) {
  set_synchronization(vsync);

  if (!GLEW_EXT_framebuffer_object) return;

  GLint fbo;
  glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &fbo);

  GLuint ColorBufferID, DepthBufferID;

  // Cleanup the multi-sampler fbo if turning off multi-sampling
  if (samples == 0) {
    if (enigma::msaa_fbo != 0) {
      glDeleteFramebuffers(1, &enigma::msaa_fbo);
      enigma::msaa_fbo = 0;
    }
    return;
  }

  //TODO: Change the code below to fix this to size properly to views
  // If we don't already have a multi-sample fbo then create one
  if (enigma::msaa_fbo == 0) {
    glGenFramebuffersEXT(1, &enigma::msaa_fbo);
  }
  glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, enigma::msaa_fbo);
  // Now make a multi-sample color buffer
  glGenRenderbuffersEXT(1, &ColorBufferID);
  glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, ColorBufferID);
  glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, GL_RGBA8, window_get_region_width(), window_get_region_height());
  // We also need a depth buffer
  glGenRenderbuffersEXT(1, &DepthBufferID);
  glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthBufferID);
  glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, GL_DEPTH_COMPONENT24, window_get_region_width(), window_get_region_height());
  // Attach the render buffers to the multi-sampler fbo
  glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, ColorBufferID);
  glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, DepthBufferID);
}
Ejemplo n.º 4
0
void display_reset(int samples, bool vsync) {
    set_synchronization(vsync);
    //TODO: Copy over from the Win32 bridge
}