extern int user_main()
#line 10 "upc_pthread_hello_world.upc"
{
#line 10 "upc_pthread_hello_world.upc"
  UPCR_BEGIN_FUNCTION();
  struct _opaque_pthread_t * tx;
  
#line 12 "upc_pthread_hello_world.upc"
  if(((int) upcr_mythread () ) == 0)
#line 12 "upc_pthread_hello_world.upc"
  {
#line 13 "upc_pthread_hello_world.upc"
    pthread_create(&tx, (const struct _opaque_pthread_attr_t *) 0U, &pthread_hello_world, "ThreadX");
  }
#line 15 "upc_pthread_hello_world.upc"
  printf("Hello from %d of %d\n", ((int) upcr_mythread () ), ((int) upcr_threads () ));
#line 16 "upc_pthread_hello_world.upc"
  upcr_barrier(-1622839611, 1);
#line 17 "upc_pthread_hello_world.upc"
  printf("Second Hello World from %d of %d\n", ((int) upcr_mythread () ), ((int) upcr_threads () ));
#line 18 "upc_pthread_hello_world.upc"
  pthread_exit((void *) 0U);
#line 19 "upc_pthread_hello_world.upc"
  UPCR_EXIT_FUNCTION();
#line 19 "upc_pthread_hello_world.upc"
  return 1;
} /* user_main */
Beispiel #2
0
extern int user_main(
  int argc,
  char ** argv)
#line 14 "pgen.upc"
{
#line 14 "pgen.upc"
  UPCR_BEGIN_FUNCTION();
  register _IEEE64 _bupc_comma;
  register _INT64 _bupc_comma0;
  register _INT32 _bupc_comma1;
  register _UINT64 _bupc_comma2;
  register _IEEE64 _bupc_comma3;
  register _IEEE64 _bupc_comma4;
  register _INT64 _bupc_comma5;
  register _INT64 _bupc_comma7;
  register _INT64 _bupc_comma6;
  register _IEEE64 _bupc_comma8;
  register _IEEE64 _bupc_comma9;
  register _IEEE64 _bupc_comma10;
  _IEEE64 inputTime;
  _IEEE64 constrTime;
  _IEEE64 traversalTime;
  int n_total_kmers;
  int n_kmers_to_process_ideal;
  int start_kmer;
  int end_kmer;
  int n_kmers_to_process;
  int char_start_position;
  int chars_to_read;
  unsigned char * buffer;
  unsigned char * _bupc__casttmp9;
  struct __sFILE * input_file;
  int _bupc__spilleq10;
  unsigned long _bupc__spilleq11;
  struct memory_heap_t private_memory_heap;
  struct hash_table_t * private_hashtable;
  int nints;
  upcr_pshared_ptr_t process_kmer_list_offsets_global;
  int * process_kmer_list_offsets;
  int max_kmers_to_transfer_to_single_process;
  int nchars;
  upcr_pshared_ptr_t kmers_to_transfer_global;
  char * kmers_to_transfer;
  int i;
  int process_owner;
  int _bupc_w2c_i0;
  int n_kmers_char_to_transfer_to_self;
  int j;
  long long _bupc__spilleq12;
  void * _bupc_call5;
  struct __sFILE * _bupc_call6;
  struct hash_table_t * _bupc_call7;
  upcr_shared_ptr_t _bupc_call8;
  upcr_shared_ptr_t _bupc_call9;
  upcr_pshared_ptr_t _bupc_Mstopcvt10;
  upcr_pshared_ptr_t _bupc_Mptra11;
  int * _bupc_Mcvtptr12;
  upcr_pshared_ptr_t _bupc_Mstopcvt13;
  upcr_pshared_ptr_t _bupc_Mptra14;
  char * _bupc_Mcvtptr15;
  upcr_pshared_ptr_t _bupc_Mptra16;
  upcr_pshared_ptr_t _bupc_Mptra17;
  int _bupc_spillld18;
  upcr_pshared_ptr_t _bupc_Mptra19;
  upcr_pshared_ptr_t _bupc_Mptra20;
  upcr_shared_ptr_t _bupc_Mstopcvt21;
  
#line 17 "pgen.upc"
  inputTime = 0.0;
#line 17 "pgen.upc"
  constrTime = 0.0;
#line 17 "pgen.upc"
  traversalTime = 0.0;
#line 20 "pgen.upc"
  upcr_barrier(346153894, 1);
#line 21 "pgen.upc"
  _bupc_comma = gettime();
#line 21 "pgen.upc"
  inputTime = inputTime - _bupc_comma;
#line 24 "pgen.upc"
  _bupc_comma0 = getNumKmersInUFX((const char *) * (argv + 1LL));
#line 24 "pgen.upc"
  n_total_kmers = _bupc_comma0;
#line 25 "pgen.upc"
  n_kmers_to_process_ideal = n_total_kmers / ((int) upcr_threads () );
#line 26 "pgen.upc"
  start_kmer = ((int) upcr_mythread () ) * n_kmers_to_process_ideal;
#line 27 "pgen.upc"
  end_kmer = (((int) upcr_mythread () ) + 1) * n_kmers_to_process_ideal;
#line 28 "pgen.upc"
  if(((int) upcr_mythread () ) == (((int) upcr_threads () ) + -1))
#line 28 "pgen.upc"
  {
#line 28 "pgen.upc"
    end_kmer = n_total_kmers;
  }
#line 29 "pgen.upc"
  n_kmers_to_process = end_kmer - start_kmer;
#line 30 "pgen.upc"
  char_start_position = start_kmer * 23;
#line 31 "pgen.upc"
  chars_to_read = n_kmers_to_process * 23;
#line 32 "pgen.upc"
  _bupc_call5 = malloc((unsigned long)(_UINT64)(chars_to_read));
#line 32 "pgen.upc"
  _bupc__casttmp9 = _bupc_call5;
#line 32 "pgen.upc"
  buffer = _bupc__casttmp9;
#line 34 "pgen.upc"
  printf("Process %d: Reading and creating graph for K-mers %d - %d\n", ((int) upcr_mythread () ), start_kmer, end_kmer);
#line 37 "pgen.upc"
  _bupc_call6 = fopen((const char *) * (argv + 1LL), "r");
#line 37 "pgen.upc"
  input_file = _bupc_call6;
#line 38 "pgen.upc"
  _bupc_comma1 = fseek(input_file, (long) char_start_position, (int) 1);
#line 38 "pgen.upc"
  _bupc__spilleq10 = _bupc_comma1;
#line 38 "pgen.upc"
  if(_bupc__spilleq10 != 0)
#line 38 "pgen.upc"
  {
#line 39 "pgen.upc"
    printf("Error Seeking...");
#line 40 "pgen.upc"
    upcri_do_exit((int) 0);
  }
#line 42 "pgen.upc"
  _bupc_comma2 = fread(buffer, (unsigned long) 1ULL, (unsigned long)(_UINT64)(chars_to_read), input_file);
#line 42 "pgen.upc"
  _bupc__spilleq11 = _bupc_comma2;
#line 42 "pgen.upc"
  if(_bupc__spilleq11 != (_UINT64)(chars_to_read))
#line 42 "pgen.upc"
  {
#line 43 "pgen.upc"
    printf("Error reading...");
#line 44 "pgen.upc"
    upcri_do_exit((int) 0);
  }
#line 46 "pgen.upc"
  fclose(input_file);
#line 47 "pgen.upc"
  upcr_barrier(346153895, 1);
#line 48 "pgen.upc"
  _bupc_comma3 = gettime();
#line 48 "pgen.upc"
  inputTime = inputTime + _bupc_comma3;
#line 51 "pgen.upc"
  _bupc_comma4 = gettime();
#line 51 "pgen.upc"
  constrTime = constrTime - _bupc_comma4;
#line 56 "pgen.upc"
  _bupc_call7 = create_hash_table((long long)(n_kmers_to_process * 2), &private_memory_heap);
#line 56 "pgen.upc"
  private_hashtable = _bupc_call7;
#line 59 "pgen.upc"
  nints = ((int) upcr_threads () );
#line 60 "pgen.upc"
  _bupc_call8 = upc_all_alloc((unsigned long)(_UINT64)(((int) upcr_threads () )), (unsigned long)((_UINT64)(nints) * 4ULL));
#line 60 "pgen.upc"
  _bupc_Mstopcvt10 = UPCR_SHARED_TO_PSHARED(_bupc_call8);
#line 60 "pgen.upc"
  process_kmer_list_offsets_global = _bupc_Mstopcvt10;
#line 61 "pgen.upc"
  _bupc_Mptra11 = UPCR_ADD_PSHARED1(process_kmer_list_offsets_global, 4ULL, ((int) upcr_mythread () ));
#line 61 "pgen.upc"
  _bupc_Mcvtptr12 = (int *) UPCR_PSHARED_TO_LOCAL(_bupc_Mptra11);
#line 61 "pgen.upc"
  process_kmer_list_offsets = _bupc_Mcvtptr12;
#line 62 "pgen.upc"
  memset(process_kmer_list_offsets, (int) 0, (unsigned long)((_UINT64)(((int) upcr_threads () )) * 4ULL));
#line 64 "pgen.upc"
  max_kmers_to_transfer_to_single_process = (n_kmers_to_process_ideal / ((int) upcr_threads () )) * 2;
#line 65 "pgen.upc"
  nchars = (max_kmers_to_transfer_to_single_process * ((int) upcr_threads () )) * 23;
#line 68 "pgen.upc"
  _bupc_call9 = upc_all_alloc((unsigned long)(_UINT64)(((int) upcr_threads () )), (unsigned long)(_UINT64)(nchars));
#line 68 "pgen.upc"
  _bupc_Mstopcvt13 = UPCR_SHARED_TO_PSHARED(_bupc_call9);
#line 68 "pgen.upc"
  kmers_to_transfer_global = _bupc_Mstopcvt13;
#line 70 "pgen.upc"
  _bupc_Mptra14 = UPCR_ADD_PSHARED1(kmers_to_transfer_global, 1ULL, ((int) upcr_mythread () ));
#line 70 "pgen.upc"
  _bupc_Mcvtptr15 = (char *) UPCR_PSHARED_TO_LOCAL(_bupc_Mptra14);
#line 70 "pgen.upc"
  kmers_to_transfer = _bupc_Mcvtptr15;
#line 73 "pgen.upc"
  i = 0;
#line 73 "pgen.upc"
  while(i < (n_kmers_to_process * 23))
#line 73 "pgen.upc"
  {
#line 74 "pgen.upc"
    _bupc_comma5 = hashkmer((long long) ((int) upcr_threads () ), (char *)(buffer + i));
#line 74 "pgen.upc"
    process_owner = _bupc_comma5;
#line 76 "pgen.upc"
    if(process_owner == ((int) upcr_mythread () ))
#line 76 "pgen.upc"
    {
#line 77 "pgen.upc"
      add_kmer(private_hashtable, &private_memory_heap, buffer + i, (char)(char) * ((buffer + (i + 19)) + 1LL), (char)(char) * ((buffer + (i + 19)) + 2LL));
    }
    else
#line 77 "pgen.upc"
    {
#line 83 "pgen.upc"
      memcpy(kmers_to_transfer + (*(process_kmer_list_offsets + process_owner) + ((process_owner * max_kmers_to_transfer_to_single_process) * 23)), buffer + i, (unsigned long) 23ULL);
#line 84 "pgen.upc"
      * (process_kmer_list_offsets + process_owner) = *(process_kmer_list_offsets + process_owner) + 23;
    }
#line 86 "pgen.upc"
    _1 :;
#line 86 "pgen.upc"
    i = i + 23;
  }
#line 89 "pgen.upc"
  upcr_barrier(346153896, 1);
#line 91 "pgen.upc"
  _bupc_w2c_i0 = 0;
#line 91 "pgen.upc"
  while(_bupc_w2c_i0 < ((int) upcr_threads () ))
#line 91 "pgen.upc"
  {
#line 92 "pgen.upc"
    if(_bupc_w2c_i0 != ((int) upcr_mythread () ))
#line 92 "pgen.upc"
    {
#line 93 "pgen.upc"
      _bupc_Mptra16 = UPCR_ADD_PSHARED1(process_kmer_list_offsets_global, 4ULL, _bupc_w2c_i0);
#line 93 "pgen.upc"
      _bupc_Mptra17 = UPCR_ADD_PSHAREDI(_bupc_Mptra16, 4ULL, ((int) upcr_mythread () ));
#line 93 "pgen.upc"
      UPCR_GET_PSHARED(&_bupc_spillld18, _bupc_Mptra17, 0, 4);
#line 93 "pgen.upc"
      n_kmers_char_to_transfer_to_self = _bupc_spillld18;
#line 96 "pgen.upc"
      _bupc_Mptra19 = UPCR_ADD_PSHARED1(kmers_to_transfer_global, 1ULL, _bupc_w2c_i0);
#line 96 "pgen.upc"
      _bupc_Mptra20 = UPCR_ADD_PSHAREDI(_bupc_Mptra19, 1ULL, (((int) upcr_mythread () ) * max_kmers_to_transfer_to_single_process) * 23);
#line 96 "pgen.upc"
      _bupc_Mstopcvt21 = UPCR_PSHARED_TO_SHARED(_bupc_Mptra20);
#line 96 "pgen.upc"
      upc_memget(buffer, _bupc_Mstopcvt21, (unsigned long)(_UINT64)(n_kmers_char_to_transfer_to_self));
#line 98 "pgen.upc"
      j = 0;
#line 98 "pgen.upc"
      while(j < n_kmers_char_to_transfer_to_self)
#line 98 "pgen.upc"
      {
#line 99 "pgen.upc"
        _bupc_comma7 = hashkmer((long long) ((int) upcr_threads () ), (char *)(buffer + j));
#line 99 "pgen.upc"
        _bupc__spilleq12 = _bupc_comma7;
#line 99 "pgen.upc"
        if(_bupc__spilleq12 != (_INT64)(((int) upcr_mythread () )))
#line 99 "pgen.upc"
        {
#line 99 "pgen.upc"
          _bupc_comma6 = hashkmer((long long) ((int) upcr_threads () ), (char *)(buffer + j));
#line 99 "pgen.upc"
          printf("%d %d\n", ((int) upcr_mythread () ), _bupc_comma6);
        }
#line 100 "pgen.upc"
        add_kmer(private_hashtable, &private_memory_heap, buffer + j, (char)(char) * ((buffer + (j + 19)) + 1LL), (char)(char) * ((buffer + (j + 19)) + 2LL));
#line 101 "pgen.upc"
        _3 :;
#line 101 "pgen.upc"
        j = j + 23;
      }
    }
#line 103 "pgen.upc"
    _2 :;
#line 103 "pgen.upc"
    _bupc_w2c_i0 = _bupc_w2c_i0 + 1;
  }
#line 105 "pgen.upc"
  upcr_barrier(346153897, 1);
#line 106 "pgen.upc"
  _bupc_comma8 = gettime();
#line 106 "pgen.upc"
  constrTime = constrTime + _bupc_comma8;
#line 109 "pgen.upc"
  _bupc_comma9 = gettime();
#line 109 "pgen.upc"
  traversalTime = traversalTime - _bupc_comma9;
#line 114 "pgen.upc"
  upcr_barrier(346153898, 1);
#line 115 "pgen.upc"
  _bupc_comma10 = gettime();
#line 115 "pgen.upc"
  traversalTime = traversalTime + _bupc_comma10;
#line 119 "pgen.upc"
  if(((int) upcr_mythread () ) == 0)
#line 119 "pgen.upc"
  {
#line 120 "pgen.upc"
    printf("%s: Input set: %s\n", *argv, *(argv + 1LL));
#line 121 "pgen.upc"
    printf("Number of UPC threads: %d\n", ((int) upcr_threads () ));
#line 122 "pgen.upc"
    printf("Input reading time: %f seconds\n", inputTime);
#line 123 "pgen.upc"
    printf("Graph construction time: %f seconds\n", constrTime);
#line 124 "pgen.upc"
    printf("Graph traversal time: %f seconds\n", traversalTime);
  }
#line 126 "pgen.upc"
  UPCR_EXIT_FUNCTION();
#line 126 "pgen.upc"
  return 0;
} /* user_main */