source: LMDZ6/branches/Ocean_skin/libf/phylmd/ecrad/malloc_extension_c.h @ 5407

Last change on this file since 5407 was 3908, checked in by idelkadi, 4 years ago

Online implementation of the radiative transfer code ECRAD in the LMDZ model.

  • Inclusion of the ecrad directory containing the sources of the ECRAD code
    • interface routine : radiation_scheme.F90
  • Adaptation of compilation scripts :
    • compilation under CPP key CPP_ECRAD
    • compilation with option "-rad ecard" or "-ecard true"
    • The "-rad old/rtm/ecran" build option will need to replace the "-rrtm true" and "-ecrad true" options in the future.
  • Runing LMDZ simulations with ecrad, you need :
    • logical key iflag_rrtm = 2 in physiq.def
    • namelist_ecrad (DefLists?)
    • the directory "data" containing the configuration files is temporarily placed in ../libfphylmd/ecrad/
  • Compilation and execution are tested in the 1D case. The repository under svn would allow to continue the implementation work: tests, verification of the results, ...
File size: 4.3 KB
Line 
1/**
2 * (C) Copyright 2014- ECMWF.
3 *
4 * This software is licensed under the terms of the Apache Licence Version 2.0
5 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6 *
7 * In applying this licence, ECMWF does not waive the privileges and immunities
8 * granted to it by virtue of its status as an intergovernmental organisation
9 * nor does it submit to any jurisdiction.
10 */
11
12/* Copyright (c) 2008, Google Inc.
13 * All rights reserved.
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions are
17 * met:
18 *
19 *     * Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 *     * Redistributions in binary form must reproduce the above
22 * copyright notice, this list of conditions and the following disclaimer
23 * in the documentation and/or other materials provided with the
24 * distribution.
25 *     * Neither the name of Google Inc. nor the names of its
26 * contributors may be used to endorse or promote products derived from
27 * this software without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 *
41 * --
42 * Author: Craig Silverstein
43 *
44 * C shims for the C++ malloc_extension.h.  See malloc_extension.h for
45 * details.  Note these C shims always work on
46 * MallocExtension::instance(); it is not possible to have more than
47 * one MallocExtension object in C applications.
48 */
49
50#ifndef _MALLOC_EXTENSION_C_H_
51#define _MALLOC_EXTENSION_C_H_
52
53#include <stddef.h>
54#include <sys/types.h>
55
56/* Annoying stuff for windows -- makes sure clients can import these fns */
57#ifndef PERFTOOLS_DLL_DECL
58# ifdef _WIN32
59#   define PERFTOOLS_DLL_DECL  __declspec(dllimport)
60# else
61#   define PERFTOOLS_DLL_DECL
62# endif
63#endif
64
65#ifdef __cplusplus
66extern "C" {
67#endif
68
69#define kMallocExtensionHistogramSize 64
70
71PERFTOOLS_DLL_DECL int MallocExtension_VerifyAllMemory(void);
72PERFTOOLS_DLL_DECL int MallocExtension_VerifyNewMemory(const void* p);
73PERFTOOLS_DLL_DECL int MallocExtension_VerifyArrayNewMemory(const void* p);
74PERFTOOLS_DLL_DECL int MallocExtension_VerifyMallocMemory(const void* p);
75PERFTOOLS_DLL_DECL int MallocExtension_MallocMemoryStats(int* blocks, size_t* total,
76                                      int histogram[kMallocExtensionHistogramSize]);
77PERFTOOLS_DLL_DECL void MallocExtension_GetStats(char* buffer, int buffer_length);
78
79/* TODO(csilvers): write a C version of these routines, that perhaps
80 * takes a function ptr and a void *.
81 */
82/* void MallocExtension_GetHeapSample(string* result); */
83/* void MallocExtension_GetHeapGrowthStacks(string* result); */
84
85PERFTOOLS_DLL_DECL int MallocExtension_GetNumericProperty(const char* property, size_t* value);
86PERFTOOLS_DLL_DECL int MallocExtension_SetNumericProperty(const char* property, size_t value);
87PERFTOOLS_DLL_DECL void MallocExtension_MarkThreadIdle(void);
88PERFTOOLS_DLL_DECL void MallocExtension_MarkThreadBusy(void);
89PERFTOOLS_DLL_DECL void MallocExtension_ReleaseToSystem(size_t num_bytes);
90PERFTOOLS_DLL_DECL void MallocExtension_ReleaseFreeMemory(void);
91PERFTOOLS_DLL_DECL size_t MallocExtension_GetEstimatedAllocatedSize(size_t size);
92PERFTOOLS_DLL_DECL size_t MallocExtension_GetAllocatedSize(const void* p);
93
94/*
95 * NOTE: These enum values MUST be kept in sync with the version in
96 *       malloc_extension.h
97 */
98typedef enum {
99  MallocExtension_kUnknownOwnership = 0,
100  MallocExtension_kOwned,
101  MallocExtension_kNotOwned
102} MallocExtension_Ownership;
103
104PERFTOOLS_DLL_DECL MallocExtension_Ownership MallocExtension_GetOwnership(const void* p);
105
106#ifdef __cplusplus
107}   // extern "C"
108#endif
109
110#endif /* _MALLOC_EXTENSION_C_H_ */
Note: See TracBrowser for help on using the repository browser.