/* * Copyright 2010 Stefan Lankes, Chair for Operating Systems, * RWTH Aachen University * * 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. * * This file is part of MetalSVM. */ #include #include #include #include #include #include #include #include #include #ifdef CONFIG_ROCKCREEK #include #include #include #include #include #include #include #endif static sem_t consuming, producing; static mailbox_int32_t mbox; static int val = 0; static int consumer(void* arg) { int i, m = 0; for(i=0; i<5; i++) { sem_wait(&consuming, 0); kprintf("Consumer got %d\n", val); val = 0; sem_post(&producing); } for(i=0; i<5; i++) { mailbox_int32_fetch(&mbox, &m, 0); kprintf("Got mail %d\n", m); } return 0; } static int producer(void* arg) { int i; int mail[5] = {1, 2, 3, 4, 5}; for(i=0; i<5; i++) { sem_wait(&producing, 0); kprintf("Produce value: current val %d\n", val); val = 42; sem_post(&consuming); } for(i=0; i<5; i++) { //kprintf("Send mail %d\n", mail[i]); mailbox_int32_post(&mbox, mail[i]); } return 0; } static int foo(void* arg) { int i; if (!arg) return 0; for(i=0; i<5; i++) { kprintf("Message from core %d: %s\n", smp_id(), (char*) arg); sleep(1); } return 42; } #ifdef CONFIG_ROCKCREEK static int mail_ping(void* arg) { //icc_mail_ping(); icc_mail_ping_irq(); //icc_irq_ping(); //icc_halt(); return 0; } static int mail_noise(void*arg) { icc_mail_noise(); // generate noise in the mesh return 0; } #define N 1024 //#define N 514 #define LAZY volatile static int* A[N]; volatile static int* B[N]; volatile static int* C[N]; #if 0 #define GET_B(i, j) B[i][j] #else #define GET_B(i, j) B[j][i] #endif static int svm_test(void *arg) { uint64_t start, end; uint32_t i, j, k; int my_ue, num_ues; register int tmp; RCCE_barrier(&RCCE_COMM_WORLD); my_ue = RCCE_ue(); num_ues = RCCE_num_ues(); #if 0 if (!my_ue) { // allocate and initialize SVM region A[0] = (int*) kmalloc(3*N*N*sizeof(int)); memset((void*) A[0], 0x00, 3*N*N*sizeof(int)); // initialize matrices for(i=0; i